How to use list_tenants method in tempest

Best Python code snippet using tempest_python

test_projects_rbac.py

Source:test_projects_rbac.py Github

copy

Full Screen

...86 self.os_primary.tenants_client87 admin_tenant_id = self.os_admin.auth_provider.credentials.project_id88 non_admin_tenant_id = self.auth_provider.credentials.project_id89 self.rbac_utils.switch_role(self, toggle_rbac_role=True)90 tenants = tenants_client.list_tenants()['tenants']91 tenant_ids = [t['id'] for t in tenants]92 if admin_tenant_id not in tenant_ids:93 raise rbac_exceptions.RbacActionFailed(94 "The admin tenant id was not returned by the call to "95 "``list_tenants``.")96 if non_admin_tenant_id in tenant_ids:97 raise rbac_exceptions.RbacActionFailed(98 "The non-admin tenant id was returned by the call to "...

Full Screen

Full Screen

tenant.py

Source:tenant.py Github

copy

Full Screen

...26 return self.add(args.add, args.app_id, args.app_secret, args.force)27 elif args.delete:28 return self.delete(args.delete)29 elif args.list_tenants:30 return self.list_tenants()31 else:32 return False33 def add(self, name, app_id, app_secret, force):34 if global_config.set_tenant(name, app_id, app_secret):35 print("Successfully add tenant:", name)36 else:37 print("Failed add tenant:", name)38 def delete(self, name):39 if global_config.delete_tenant(name):40 print("Successfully delete tenant:", name)41 else:42 print("Failed delete tenant:", name)43 def list_tenants(self):44 print('List all tenants...')45 for tenant in global_config.tenants.values():46 print(tenant)...

Full Screen

Full Screen

__init__.py

Source:__init__.py Github

copy

Full Screen

...3from agavepy.settings import TAPIS_TENANTS_URL, TAPISPY_VERIFY_SSL4import requests5__all__ = ['list_tenants', 'api_server_by_id', 'id_by_api_server']6# TODO - Cache with functools lru_cache7def list_tenants(url=None, verify_ssl=TAPISPY_VERIFY_SSL):8 """List available Tapis tenants9 Returns all tenants configured in a Tapis instance.10 PARAMETERS11 ----------12 url: string (default: settings.TAPIS_TENANTS_URL)13 URL to send GET request to. This resource should list all tenants.14 RETURNS15 -------16 JSON response: dict17 If request was successful, return the json response as a dict.18 """19 if url is None:20 url = TAPIS_TENANTS_URL21 try:22 resp = requests.get(url, verify=verify_ssl)23 resp.raise_for_status()24 except Exception:25 raise26 tenants = resp.json().get('result', [])27 resp.close()28 return tenants29def api_server_by_id(tenant_id, url=None, verify_ssl=TAPISPY_VERIFY_SSL):30 """Resolve Tapis tenant ID to its API server31 """32 tenants = list_tenants(url, verify_ssl=verify_ssl)33 for t in tenants:34 if t.get('code').lower() == tenant_id.lower():35 return t.get('baseUrl')36def id_by_api_server(api_server, url=None, verify_ssl=TAPISPY_VERIFY_SSL):37 """Resolve tenant id by its API server38 """39 tenants = list_tenants(url, verify_ssl=verify_ssl)40 for t in tenants:41 # TODO - ignore presence/absence of trailing slash42 if t.get('baseUrl').lower() == api_server.lower():...

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