From 78c9139dd234281330818994c409991f9798ad12 Mon Sep 17 00:00:00 2001 From: zhufl Date: Wed, 2 Aug 2017 13:58:53 +0800 Subject: [PATCH] Remove unnecessary checks already coverd in schema This is to remove the unnecessary assertIn checks which is already covered in schema checks. Change-Id: I223a4f2d80e33fd60ecc3a8d24e93f5e80f8d0bf --- tempest/api/compute/admin/test_quotas.py | 1 - tempest/api/compute/certificates/test_certificates.py | 9 ++------- tempest/api/compute/keypairs/test_keypairs.py | 2 -- .../api/compute/security_groups/test_security_groups.py | 2 -- .../security_groups/test_security_groups_negative.py | 2 -- tempest/api/compute/volumes/test_volumes_get.py | 2 -- 6 files changed, 2 insertions(+), 16 deletions(-) diff --git a/tempest/api/compute/admin/test_quotas.py b/tempest/api/compute/admin/test_quotas.py index 937540e2ad..1aa9227edb 100644 --- a/tempest/api/compute/admin/test_quotas.py +++ b/tempest/api/compute/admin/test_quotas.py @@ -169,7 +169,6 @@ class QuotaClassesAdminTestJSON(base.BaseV2ComputeAdminTest): LOG.debug("get the current 'default' quota class values") body = (self.adm_client.show_quota_class_set('default') ['quota_class_set']) - self.assertIn('id', body) self.assertEqual('default', body.pop('id')) # restore the defaults when the test is done self.addCleanup(self._restore_default_quotas, body.copy()) diff --git a/tempest/api/compute/certificates/test_certificates.py b/tempest/api/compute/certificates/test_certificates.py index a39fec95dc..0e6c016136 100644 --- a/tempest/api/compute/certificates/test_certificates.py +++ b/tempest/api/compute/certificates/test_certificates.py @@ -31,14 +31,9 @@ class CertificatesV2TestJSON(base.BaseV2ComputeTest): @decorators.idempotent_id('c070a441-b08e-447e-a733-905909535b1b') def test_create_root_certificate(self): # create certificates - body = self.certificates_client.create_certificate()['certificate'] - self.assertIn('data', body) - self.assertIn('private_key', body) + self.certificates_client.create_certificate() @decorators.idempotent_id('3ac273d0-92d2-4632-bdfc-afbc21d4606c') def test_get_root_certificate(self): # get the root certificate - body = (self.certificates_client.show_certificate('root') - ['certificate']) - self.assertIn('data', body) - self.assertIn('private_key', body) + self.certificates_client.show_certificate('root') diff --git a/tempest/api/compute/keypairs/test_keypairs.py b/tempest/api/compute/keypairs/test_keypairs.py index 0b7a9675dc..a35e60a124 100644 --- a/tempest/api/compute/keypairs/test_keypairs.py +++ b/tempest/api/compute/keypairs/test_keypairs.py @@ -65,8 +65,6 @@ class KeyPairsV2TestJSON(base.BaseKeypairTest): k_name = data_utils.rand_name('keypair') self.create_keypair(k_name) keypair_detail = self.client.show_keypair(k_name)['keypair'] - self.assertIn('name', keypair_detail) - self.assertIn('public_key', keypair_detail) self.assertEqual(keypair_detail['name'], k_name, "The created keypair name is not equal " "to requested name") diff --git a/tempest/api/compute/security_groups/test_security_groups.py b/tempest/api/compute/security_groups/test_security_groups.py index 930a58ef0d..a101a19b73 100644 --- a/tempest/api/compute/security_groups/test_security_groups.py +++ b/tempest/api/compute/security_groups/test_security_groups.py @@ -69,7 +69,6 @@ class SecurityGroupsTestJSON(base.BaseSecurityGroupsTest): # leading and trailing spaces s_name = ' %s ' % data_utils.rand_name('securitygroup ') securitygroup = self.create_security_group(name=s_name) - self.assertIn('name', securitygroup) securitygroup_name = securitygroup['name'] self.assertEqual(securitygroup_name, s_name, "The created Security Group name is " @@ -131,7 +130,6 @@ class SecurityGroupsTestJSON(base.BaseSecurityGroupsTest): # Update security group name and description # Create a security group securitygroup = self.create_security_group() - self.assertIn('id', securitygroup) securitygroup_id = securitygroup['id'] # Update the name and description s_new_name = data_utils.rand_name('sg-hth') diff --git a/tempest/api/compute/security_groups/test_security_groups_negative.py b/tempest/api/compute/security_groups/test_security_groups_negative.py index 207778a4c2..c4dff153b8 100644 --- a/tempest/api/compute/security_groups/test_security_groups_negative.py +++ b/tempest/api/compute/security_groups/test_security_groups_negative.py @@ -154,7 +154,6 @@ class SecurityGroupsNegativeTestJSON(base.BaseSecurityGroupsTest): def test_update_security_group_with_invalid_sg_name(self): # Update security_group with invalid sg_name should fail securitygroup = self.create_security_group() - self.assertIn('id', securitygroup) securitygroup_id = securitygroup['id'] # Update Security Group with group name longer than 255 chars s_new_name = 'securitygroup-'.ljust(260, '0') @@ -170,7 +169,6 @@ class SecurityGroupsNegativeTestJSON(base.BaseSecurityGroupsTest): def test_update_security_group_with_invalid_sg_des(self): # Update security_group with invalid sg_des should fail securitygroup = self.create_security_group() - self.assertIn('id', securitygroup) securitygroup_id = securitygroup['id'] # Update Security Group with group description longer than 255 chars s_new_des = 'des-'.ljust(260, '0') diff --git a/tempest/api/compute/volumes/test_volumes_get.py b/tempest/api/compute/volumes/test_volumes_get.py index 01cfb5f3d7..cb6ab43567 100644 --- a/tempest/api/compute/volumes/test_volumes_get.py +++ b/tempest/api/compute/volumes/test_volumes_get.py @@ -52,8 +52,6 @@ class VolumesGetTestJSON(base.BaseV2ComputeTest): volume = self.create_volume(size=CONF.volume.volume_size, display_name=v_name, metadata=metadata) - self.assertIn('id', volume) - self.assertIn('displayName', volume) self.assertEqual(volume['displayName'], v_name, "The created volume name is not equal " "to the requested name")