Remove zone wrapper object in Tempest tests

Change-Id: Ice135dd29b357827c1ceabf6cf8e83316c82a724
This commit is contained in:
Paul Glass 2015-04-03 15:28:15 +00:00
parent 12a0eeef38
commit 4620275cdb
3 changed files with 17 additions and 18 deletions

View File

@ -48,7 +48,7 @@ class ZoneTest(BaseDesignateTest):
def _create_zone(self, zone_model): def _create_zone(self, zone_model):
resp, model = self.client.post_zone(zone_model) resp, model = self.client.post_zone(zone_model)
self.assertEqual(resp.status, 202) self.assertEqual(resp.status, 202)
self.wait_for_zone(model.zone.id) self.wait_for_zone(model.id)
return resp, model return resp, model
def test_list_zones(self): def test_list_zones(self):
@ -65,21 +65,21 @@ class ZoneTest(BaseDesignateTest):
resp, old_model = self._create_zone(post_model) resp, old_model = self._create_zone(post_model)
patch_model = datagen.random_zone_data() patch_model = datagen.random_zone_data()
del patch_model.zone.name # don't try to override the zone name del patch_model.name # don't try to override the zone name
resp, new_model = self.client.patch_zone(old_model.zone.id, resp, new_model = self.client.patch_zone(old_model.id,
patch_model) patch_model)
self.assertEqual(resp.status, 202) self.assertEqual(resp.status, 202)
self.wait_for_zone(new_model.zone.id) self.wait_for_zone(new_model.id)
resp, model = self.client.get_zone(new_model.zone.id) resp, model = self.client.get_zone(new_model.id)
self.assertEqual(resp.status, 200) self.assertEqual(resp.status, 200)
self.assertEqual(new_model.zone.id, old_model.zone.id) self.assertEqual(new_model.id, old_model.id)
self.assertEqual(new_model.zone.name, old_model.zone.name) self.assertEqual(new_model.name, old_model.name)
self.assertEqual(new_model.zone.ttl, patch_model.zone.ttl) self.assertEqual(new_model.ttl, patch_model.ttl)
self.assertEqual(new_model.zone.email, patch_model.zone.email) self.assertEqual(new_model.email, patch_model.email)
def test_delete_zone(self): def test_delete_zone(self):
resp, model = self._create_zone(datagen.random_zone_data()) resp, model = self._create_zone(datagen.random_zone_data())
resp, model = self.client.delete_zone(model.zone.id) resp, model = self.client.delete_zone(model.id)
self.assertEqual(resp.status, 202) self.assertEqual(resp.status, 202)
self.wait_for_404(model.zone.id) self.wait_for_404(model.id)

View File

@ -39,9 +39,9 @@ class BaseDesignateTest(tempest_lib.base.BaseTestCase):
def is_zone_active(self, zone_id): def is_zone_active(self, zone_id):
resp, model = self.client.get_zone(zone_id) resp, model = self.client.get_zone(zone_id)
self.assertEqual(resp.status, 200) self.assertEqual(resp.status, 200)
if model.zone.status == 'ACTIVE': if model.status == 'ACTIVE':
return True return True
elif model.zone.status == 'ERROR': elif model.status == 'ERROR':
raise Exception("Saw ERROR status") raise Exception("Saw ERROR status")
return False return False

View File

@ -48,8 +48,7 @@ def random_zone_data(name=None, email=None, ttl=None, description=None):
if ttl is None: if ttl is None:
ttl = random.randint(1200, 8400), ttl = random.randint(1200, 8400),
return ZoneModel.from_dict({ return ZoneModel.from_dict({
'zone': { 'name': name,
'name': name, 'email': email,
'email': email, 'ttl': random.randint(1200, 8400),
'ttl': random.randint(1200, 8400), 'description': description})
'description': description}})