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 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)