How to use assign_user_role_on_domain method in tempest

Best Python code snippet using tempest_python

cred_client.py

Source:cred_client.py Github

copy

Full Screen

...136 def _assign_user_role(self, project, user, role):137 self.roles_client.assign_user_role_on_project(project['id'],138 user['id'],139 role['id'])140 def assign_user_role_on_domain(self, user, role_name, domain=None):141 """Assign the specified role on a domain142 :param user: a user dict143 :param role_name: name of the role to be assigned144 :param domain: (optional) The domain to assign the role on. If not145 specified the default domain of cred_client146 """147 # NOTE(andreaf) This method is very specific to the v3 case, and148 # because of that it's not defined in the parent class.149 if domain is None:150 domain = self.creds_domain151 role = self._check_role_exists(role_name)152 if not role:153 msg = 'No "%s" role found' % role_name154 raise lib_exc.NotFound(msg)155 try:156 self.roles_client.assign_user_role_on_domain(157 domain['id'], user['id'], role['id'])158 except lib_exc.Conflict:159 LOG.debug("Role %s already assigned on domain %s for user %s",160 role['id'], domain['id'], user['id'])161def get_creds_client(identity_client,162 projects_client,163 users_client,164 roles_client,165 domains_client=None,166 project_domain_name=None):167 if isinstance(identity_client, v2_identity.IdentityClient):168 return V2CredsClient(identity_client, projects_client, users_client,169 roles_client)170 else:...

Full Screen

Full Screen

test_roles.py

Source:test_roles.py Github

copy

Full Screen

...91 self.client.delete_role_from_user_on_project(92 self.project['id'], self.user_body['id'], self.role['id'])93 @test.idempotent_id('6c9a2940-3625-43a3-ac02-5dcec62ef3bd')94 def test_grant_list_revoke_role_to_user_on_domain(self):95 self.client.assign_user_role_on_domain(96 self.domain['id'], self.user_body['id'], self.role['id'])97 roles = self.client.list_user_roles_on_domain(98 self.domain['id'], self.user_body['id'])['roles']99 for i in roles:100 self.fetched_role_ids.append(i['id'])101 self._list_assertions(roles, self.fetched_role_ids,102 self.role['id'])103 self.client.delete_role_from_user_on_domain(104 self.domain['id'], self.user_body['id'], self.role['id'])105 @test.idempotent_id('cbf11737-1904-4690-9613-97bcbb3df1c4')106 def test_grant_list_revoke_role_to_group_on_project(self):107 # Grant role to group on project108 self.client.assign_group_role_on_project(109 self.project['id'], self.group_body['id'], self.role['id'])...

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