Best Python code snippet using tempest_python
test_tenants.py
Source:test_tenants.py
...16from tempest.lib.common.utils import data_utils17from tempest.lib import decorators18class TenantsTestJSON(base.BaseIdentityV2AdminTest):19 @decorators.idempotent_id('16c6e05c-6112-4b0e-b83f-5e43f221b6b0')20 def test_tenant_list_delete(self):21 # Create several tenants and delete them22 tenants = []23 for _ in range(3):24 tenant = self.setup_test_tenant()25 tenants.append(tenant)26 tenant_ids = [tn['id'] for tn in tenants]27 body = self.tenants_client.list_tenants()['tenants']28 found = [t for t in body if t['id'] in tenant_ids]29 self.assertEqual(len(found), len(tenants), 'Tenants not created')30 for tenant in tenants:31 self.tenants_client.delete_tenant(tenant['id'])32 body = self.tenants_client.list_tenants()['tenants']33 found = [tenant for tenant in body if tenant['id'] in tenant_ids]34 self.assertEmpty(found, 'Tenants failed to delete')...
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!!