Best Python code snippet using tempest_python
test_roles_rbac.py
Source:test_roles_rbac.py
...295 self.group['id'])296 @decorators.idempotent_id('2aef3eaa-8156-4962-a01d-c9bb0e499e15')297 @rbac_rule_validation.action(service="keystone",298 rule="identity:create_implied_role")299 def test_create_role_inference_rule(self):300 self.rbac_utils.switch_role(self, toggle_rbac_role=True)301 self.roles_client.create_role_inference_rule(302 self.role['id'], self.implies_role['id'])['role_inference']303 self.addCleanup(self.roles_client.delete_role_inference_rule,304 self.role['id'], self.implies_role['id'])305 @decorators.idempotent_id('83f997b2-55c4-4894-b1f2-e175b19d1fa5')306 @rbac_rule_validation.action(service="keystone",307 rule="identity:get_implied_role")308 def test_show_role_inference_rule(self):309 self.roles_client.create_role_inference_rule(310 self.role['id'], self.implies_role['id'])311 self.addCleanup(self.roles_client.delete_role_inference_rule,312 self.role['id'], self.implies_role['id'])313 self.rbac_utils.switch_role(self, toggle_rbac_role=True)314 self.roles_client.show_role_inference_rule(315 self.role['id'], self.implies_role['id'])['role_inference']316 @decorators.idempotent_id('f7bb39bf-0b06-468e-a8b0-60a4fb1f258d')317 @rbac_rule_validation.action(service="keystone",318 rule="identity:list_implied_roles")319 def test_list_role_inferences_rules(self):320 self.rbac_utils.switch_role(self, toggle_rbac_role=True)321 self.roles_client.list_role_inferences_rules(self.role['id'])[322 'role_inference']323 @decorators.idempotent_id('eca2d502-09bb-45cd-9773-bce2e7bcddd1')324 @rbac_rule_validation.action(service="keystone",325 rule="identity:check_implied_role")326 def test_check_role_inference_rule(self):327 self.roles_client.create_role_inference_rule(328 self.role['id'], self.implies_role['id'])329 self.addCleanup(self.roles_client.delete_role_inference_rule,330 self.role['id'], self.implies_role['id'])331 self.rbac_utils.switch_role(self, toggle_rbac_role=True)332 self.roles_client.check_role_inference_rule(333 self.role['id'], self.implies_role['id'])334 @decorators.idempotent_id('13a5db1e-dd4a-4ca1-81ec-d5452aaaf54b')335 @rbac_rule_validation.action(service="keystone",336 rule="identity:delete_implied_role")337 def test_delete_role_inference_rule(self):338 self.roles_client.create_role_inference_rule(339 self.role['id'], self.implies_role['id'])340 self.addCleanup(test_utils.call_and_ignore_notfound_exc,341 self.roles_client.delete_role_inference_rule,342 self.role['id'], self.implies_role['id'])343 self.rbac_utils.switch_role(self, toggle_rbac_role=True)344 self.roles_client.delete_role_inference_rule(345 self.role['id'], self.implies_role['id'])346 @decorators.idempotent_id('05869f2b-4dd4-425a-905e-eec9a6f06374')347 @rbac_rule_validation.action(service="keystone",348 rule="identity:list_role_inference_rules")349 def test_list_all_role_inference_rules(self):350 self.rbac_utils.switch_role(self, toggle_rbac_role=True)...
test_implied_role.py
Source:test_implied_role.py
...88 self.addCleanup(self.admin_roles_client.delete_role_inference_rule,89 prior_role=self.prior_role,90 implies_role=self.implied_role)91 def test_identity_get_implied_role(self):92 self.admin_roles_client.create_role_inference_rule(93 prior_role=self.prior_role, implies_role=self.implied_role)94 self.addCleanup(self.admin_roles_client.delete_role_inference_rule,95 prior_role=self.prior_role,96 implies_role=self.implied_role)97 self.do_request('show_role_inference_rule',98 prior_role=self.prior_role,99 implies_role=self.implied_role)100 def test_identity_list_implied_roles(self):101 self.admin_roles_client.create_role_inference_rule(102 prior_role=self.prior_role, implies_role=self.implied_role)103 self.addCleanup(self.admin_roles_client.delete_role_inference_rule,104 prior_role=self.prior_role,105 implies_role=self.implied_role)106 self.do_request('list_role_inferences_rules',107 prior_role=self.prior_role)108 def test_identity_list_role_inference_rules(self):109 self.admin_roles_client.create_role_inference_rule(110 prior_role=self.prior_role, implies_role=self.implied_role)111 self.addCleanup(self.admin_roles_client.delete_role_inference_rule,112 prior_role=self.prior_role,113 implies_role=self.implied_role)114 self.do_request('list_all_role_inference_rules')115 def test_identity_delete_implied_role(self):116 self.admin_roles_client.create_role_inference_rule(117 prior_role=self.prior_role, implies_role=self.implied_role)118 self.do_request('delete_role_inference_rule',119 expected_status=204,120 prior_role=self.prior_role,121 implies_role=self.implied_role)122 def test_identity_check_implied_role(self):123 self.admin_roles_client.create_role_inference_rule(124 prior_role=self.prior_role, implies_role=self.implied_role)125 self.addCleanup(self.admin_roles_client.delete_role_inference_rule,126 prior_role=self.prior_role,127 implies_role=self.implied_role)128 self.do_request('check_role_inference_rule',129 expected_status=204,130 prior_role=self.prior_role,131 implies_role=self.implied_role)132class SystemMemberTests(SystemAdminTests):133 credentials = ['system_member', 'system_admin']134 def test_identity_create_implied_role(self):135 self.do_request('create_role_inference_rule',136 expected_status=exceptions.Forbidden,137 prior_role=self.prior_role,138 implies_role=self.implied_role)139 def test_identity_delete_implied_role(self):140 self.admin_roles_client.create_role_inference_rule(141 prior_role=self.prior_role, implies_role=self.implied_role)142 self.addCleanup(self.admin_roles_client.delete_role_inference_rule,143 prior_role=self.prior_role,144 implies_role=self.implied_role)145 self.do_request('delete_role_inference_rule',146 expected_status=exceptions.Forbidden,147 prior_role=self.prior_role,148 implies_role=self.implied_role)149class SystemReaderTests(SystemMemberTests):150 credentials = ['system_reader', 'system_admin']151class DomainAdminTests(SystemReaderTests):152 credentials = ['domain_admin', 'system_admin']153 def test_identity_get_implied_role(self):154 self.admin_roles_client.create_role_inference_rule(155 prior_role=self.prior_role, implies_role=self.implied_role)156 self.addCleanup(self.admin_roles_client.delete_role_inference_rule,157 prior_role=self.prior_role,158 implies_role=self.implied_role)159 self.do_request('show_role_inference_rule',160 expected_status=exceptions.Forbidden,161 prior_role=self.prior_role,162 implies_role=self.implied_role)163 def test_identity_list_implied_roles(self):164 self.admin_roles_client.create_role_inference_rule(165 prior_role=self.prior_role, implies_role=self.implied_role)166 self.addCleanup(self.admin_roles_client.delete_role_inference_rule,167 prior_role=self.prior_role,168 implies_role=self.implied_role)169 self.do_request('list_role_inferences_rules',170 expected_status=exceptions.Forbidden,171 prior_role=self.prior_role)172 def test_identity_list_role_inference_rules(self):173 self.admin_roles_client.create_role_inference_rule(174 prior_role=self.prior_role, implies_role=self.implied_role)175 self.addCleanup(self.admin_roles_client.delete_role_inference_rule,176 prior_role=self.prior_role,177 implies_role=self.implied_role)178 self.do_request('list_all_role_inference_rules',179 expected_status=exceptions.Forbidden)180 def test_identity_check_implied_role(self):181 self.admin_roles_client.create_role_inference_rule(182 prior_role=self.prior_role, implies_role=self.implied_role)183 self.addCleanup(self.admin_roles_client.delete_role_inference_rule,184 prior_role=self.prior_role,185 implies_role=self.implied_role)186 self.do_request('check_role_inference_rule',187 expected_status=exceptions.Forbidden,188 prior_role=self.prior_role,189 implies_role=self.implied_role)190class DomainMemberTests(DomainAdminTests):191 credentials = ['domain_member', 'system_admin']192class DomainReaderTests(DomainMemberTests):193 credentials = ['domain_reader', 'system_admin']194class ProjectAdminTests(DomainReaderTests):195 credentials = ['project_admin', 'system_admin']...
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!!