def test__validate_spec(self):
    MACHINE = self.c.JujuTypes.MACHINE
    UNIT = self.c.JujuTypes.UNIT
    valid_specs = (('0', MACHINE), ('9', MACHINE), ('15', MACHINE), ('0/lxd/10', MACHINE), ('1/LXD/4', MACHINE), ('some-unit-0/14', UNIT), ('other/23', UNIT))
    invalid_specs = ('b', '1/spec/2', 'other-unit', 'd/10/10')
    for (spec, type_) in valid_specs:
        self.c.machine_or_unit_spec = spec
        self.c._validate_spec()
        self.assertEqual(self.c._juju_type, type_)
    for spec in invalid_specs:
        self.c.machine_or_unit_spec = spec
        with self.assertRaises(ValueError):
            self.c._validate_spec()
def test__validate_spec(self):
    MACHINE = self.c.JujuTypes.MACHINE
    UNIT = self.c.JujuTypes.UNIT
    valid_specs = (('0', MACHINE), ('9', MACHINE), ('15', MACHINE), ('0/lxd/10', MACHINE), ('1/LXD/4', MACHINE), ('some-unit-0/14', UNIT), ('other/23', UNIT))
    invalid_specs = ('b', '1/spec/2', 'other-unit', 'd/10/10')
    for (spec, type_) in valid_specs:
        self.c.machine_or_unit_spec = spec
        self.c._validate_spec()
        self.assertEqual(self.c._juju_type, type_)
    for spec in invalid_specs:
        self.c.machine_or_unit_spec = spec
        with self.assertRaises(ValueError):
            self.c._validate_spec()