Best Python code snippet using tempest_python
test_volume_quotas.py
Source:test_volume_quotas.py
...30 self.assertIn(key, quotas)31 @test.attr(type='gate')32 @test.idempotent_id('2be020a2-5fdd-423d-8d35-a7ffbc36e9f7')33 def test_list_default_quotas(self):34 quotas = self.quotas_client.show_default_quota_set(35 self.demo_tenant_id)36 for key in QUOTA_KEYS:37 self.assertIn(key, quotas)38 @test.attr(type='gate')39 @test.idempotent_id('3d45c99e-cc42-4424-a56e-5cbd212b63a6')40 def test_update_all_quota_resources_for_tenant(self):41 # Admin can update all the resource quota limits for a tenant42 default_quota_set = self.quotas_client.show_default_quota_set(43 self.demo_tenant_id)44 new_quota_set = {'gigabytes': 1009,45 'volumes': 11,46 'snapshots': 11}47 # Update limits for all quota resources48 quota_set = self.quotas_client.update_quota_set(49 self.demo_tenant_id,50 **new_quota_set)51 cleanup_quota_set = dict(52 (k, v) for k, v in default_quota_set.iteritems()53 if k in QUOTA_KEYS)54 self.addCleanup(self.quotas_client.update_quota_set,55 self.demo_tenant_id, **cleanup_quota_set)56 # test that the specific values we set are actually in57 # the final result. There is nothing here that ensures there58 # would be no other values in there.59 self.assertDictContainsSubset(new_quota_set, quota_set)60 @test.attr(type='gate')61 @test.idempotent_id('18c51ae9-cb03-48fc-b234-14a19374dbed')62 def test_show_quota_usage(self):63 quota_usage = self.quotas_client.show_quota_usage(64 self.os_adm.credentials.tenant_id)65 for key in QUOTA_KEYS:66 self.assertIn(key, quota_usage)67 for usage_key in QUOTA_USAGE_KEYS:68 self.assertIn(usage_key, quota_usage[key])69 @test.attr(type='gate')70 @test.idempotent_id('ae8b6091-48ad-4bfa-a188-bbf5cc02115f')71 def test_quota_usage(self):72 quota_usage = self.quotas_client.show_quota_usage(73 self.demo_tenant_id)74 volume = self.create_volume()75 self.addCleanup(self.admin_volume_client.delete_volume,76 volume['id'])77 new_quota_usage = self.quotas_client.show_quota_usage(78 self.demo_tenant_id)79 self.assertEqual(quota_usage['volumes']['in_use'] + 1,80 new_quota_usage['volumes']['in_use'])81 self.assertEqual(quota_usage['gigabytes']['in_use'] +82 volume["size"],83 new_quota_usage['gigabytes']['in_use'])84 @test.attr(type='gate')85 @test.idempotent_id('874b35a9-51f1-4258-bec5-cd561b6690d3')86 def test_delete_quota(self):87 # Admin can delete the resource quota set for a tenant88 tenant_name = data_utils.rand_name('quota_tenant_')89 identity_client = self.os_adm.identity_client90 tenant = identity_client.create_tenant(tenant_name)91 tenant_id = tenant['id']92 self.addCleanup(identity_client.delete_tenant, tenant_id)93 quota_set_default = self.quotas_client.show_default_quota_set(94 tenant_id)95 volume_default = quota_set_default['volumes']96 self.quotas_client.update_quota_set(tenant_id,97 volumes=(int(volume_default) + 5))98 self.quotas_client.delete_quota_set(tenant_id)99 quota_set_new = self.quotas_client.show_quota_set(tenant_id)100 self.assertEqual(volume_default, quota_set_new['volumes'])101class VolumeQuotasAdminV1TestJSON(BaseVolumeQuotasAdminV2TestJSON):...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!