How to use _check_quotas method in tempest

Best Python code snippet using tempest_python

test_quotas.py

Source:test_quotas.py Github

copy

Full Screen

...34 if not test.is_extension_enabled('quotas', 'network'):35 msg = "quotas extension not enabled."36 raise cls.skipException(msg)37 cls.identity_admin_client = cls.os_adm.identity_client38 def _check_quotas(self, new_quotas):39 # Add a tenant to conduct the test40 test_tenant = data_utils.rand_name('test_tenant_')41 test_description = data_utils.rand_name('desc_')42 tenant = self.identity_admin_client.create_tenant(43 name=test_tenant,44 description=test_description)45 tenant_id = tenant['id']46 self.addCleanup(self.identity_admin_client.delete_tenant, tenant_id)47 # Change quotas for tenant48 quota_set = self.admin_client.update_quotas(tenant_id,49 **new_quotas)50 self.addCleanup(self.admin_client.reset_quotas, tenant_id)51 for key, value in new_quotas.iteritems():52 self.assertEqual(value, quota_set[key])53 # Confirm our tenant is listed among tenants with non default quotas54 non_default_quotas = self.admin_client.list_quotas()55 found = False56 for qs in non_default_quotas['quotas']:57 if qs['tenant_id'] == tenant_id:58 found = True59 self.assertTrue(found)60 # Confirm from API quotas were changed as requested for tenant61 quota_set = self.admin_client.show_quotas(tenant_id)62 quota_set = quota_set['quota']63 for key, value in new_quotas.iteritems():64 self.assertEqual(value, quota_set[key])65 # Reset quotas to default and confirm66 self.admin_client.reset_quotas(tenant_id)67 non_default_quotas = self.admin_client.list_quotas()68 for q in non_default_quotas['quotas']:69 self.assertNotEqual(tenant_id, q['tenant_id'])70 @test.attr(type='gate')71 @test.idempotent_id('2390f766-836d-40ef-9aeb-e810d78207fb')72 def test_quotas(self):73 new_quotas = {'network': 0, 'security_group': 0}74 self._check_quotas(new_quotas)75 @test.idempotent_id('a7add2b1-691e-44d6-875f-697d9685f091')76 @test.requires_ext(extension='lbaas', service='network')77 @test.attr(type='gate')78 def test_lbaas_quotas(self):79 new_quotas = {'vip': 1, 'pool': 2,80 'member': 3, 'health_monitor': 4}...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tempest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful