def test_get_missing_next_free_uuid(self): """Retrieve missing next free uuid; raise NotFound""" next_uuid = SpokeHostUUID() next_uuid.delete() next_uuid.__init__() self.assertRaises(error.NotFound, next_uuid.get) next_uuid.create(self.next_uuid_start)
def tearDown(self): """Delete test organisation and host""" host = SpokeHost(self.org_name) host.delete(self.host_name) org = SpokeOrg() org.delete(self.org_name, self.org_children) next_uuid = SpokeHostUUID() next_uuid.delete()
def test_create_next_free_uuid(self): """Create next free uuid; return uuid as list.""" next_uuid = SpokeHostUUID() next_uuid.delete() # Re init so it detects the delete next_uuid.__init__() result = next_uuid.create(self.next_uuid_start) expected_data = [1] self.assertEqual(result['data'], expected_data)
def test_create_next_free_uuid_non_integer(self): """Create next free uuid with non integer; raise InputError.""" next_uuid = SpokeHostUUID() next_uuid.delete() # Re init so it detects the delete next_uuid.__init__() next_uuid_start = 'three' self.assertRaises(error.InputError, next_uuid.create, next_uuid_start) next_uuid.create(self.next_uuid_start)
def test_create_next_free_uuid_mac(self): """Create next free uuid + mac; return as tuple.""" next_uuid = SpokeHostUUID() next_uuid.delete() # Re init so it detects the delete next_uuid.__init__() result = next_uuid.create(self.next_uuid_start, get_mac=True) expected_data = (1, '02:00:00:01:00:00') self.assertEqual(result['data'], expected_data)
def uuid_delete(): try: conf = _spoke_config(_salt_config('config')) uuid = SpokeHostUUID() result = uuid.delete() except error.SpokeError as e: result = common.handle_error(e) return result
def uuid_delete(): try: from spoke.lib.host import SpokeHostUUID uuid = SpokeHostUUID() result = uuid.delete() except error.SpokeError as e: result = common.handle_error(e) return result