Best Python code snippet using tempest_python
test_domain_config.py
Source:test_domain_config.py
...95 * whether the persona can update an option in a domain config96 """97 pass98 @abc.abstractmethod99 def test_identity_delete_domain_config(self):100 """Test identity:delete_domain_config policy.101 This test must check102 * whether the persona can delete a domain config103 * whether the persona can delete an option group within a domain104 config105 * whether the persona can delete an option within a domain config106 """107 pass108class SystemAdminTests(IdentityV3RbacDomainConfigTest, base.BaseIdentityTest):109 credentials = ['system_admin']110 def test_identity_create_domain_config(self):111 self.do_request(112 'create_domain_config',113 expected_status=201,114 domain_id=self.domain_id,115 **self.domain_config())116 self.addCleanup(117 self.admin_domain_config_client.delete_domain_config,118 self.domain_id)119 def test_identity_get_domain_config(self):120 # should be able to get domain config, group and individual options121 self.admin_domain_config_client.create_domain_config(122 self.domain_id, **self.domain_config())123 self.addCleanup(124 self.admin_domain_config_client.delete_domain_config,125 self.domain_id)126 self.do_request(127 'show_domain_config',128 domain_id=self.domain_id)129 self.do_request(130 'show_domain_group_config',131 domain_id=self.domain_id,132 group='ldap')133 self.do_request(134 'show_domain_group_option_config',135 domain_id=self.domain_id,136 group='ldap',137 option='url')138 # should get Not Found for invalid domain139 self.do_request(140 'show_domain_config',141 expected_status=exceptions.NotFound,142 domain_id=data_utils.rand_uuid_hex())143 # should get Not Found for nonexistent config for valid domain144 domain = self.admin_client.domains_client.create_domain(145 name=data_utils.rand_name('domain'))['domain']['id']146 self.addCleanup(self.admin_client.domains_client.delete_domain, domain)147 self.addCleanup(148 self.admin_client.domains_client.update_domain,149 domain, enabled=False)150 self.do_request(151 'show_domain_config',152 expected_status=exceptions.NotFound,153 domain_id=domain)154 def test_identity_get_domain_config_default(self):155 self.do_request('show_default_config_settings')156 self.do_request('show_default_group_config', group='ldap')157 self.do_request(158 'show_default_group_option', group='ldap', option='url')159 def test_identity_get_security_compliance_domain_config(self):160 self.do_request(161 'show_domain_group_config',162 domain_id='default',163 group='security_compliance')164 self.do_request(165 'show_domain_group_option_config',166 domain_id='default',167 group='security_compliance',168 option='password_regex_description')169 def test_identity_update_domain_config(self):170 self.admin_domain_config_client.create_domain_config(171 self.domain_id, **self.domain_config())172 self.addCleanup(173 self.admin_domain_config_client.delete_domain_config,174 self.domain_id)175 self.do_request(176 'update_domain_group_config',177 domain_id=self.domain_id,178 group='ldap',179 ldap={'url': 'ldaps://myldap.com:636/',180 'user_tree_dn': 'ou=People,dc=my_new_root,dc=org'})181 self.do_request(182 'update_domain_group_option_config',183 domain_id=self.domain_id,184 group='ldap',185 option='user_tree_dn',186 user_tree_dn='ou=Aliens,dc=my_new_root,dc=org')187 # test changing the entire config last188 self.do_request(189 'update_domain_config',190 domain_id=self.domain_id,191 identity={"driver": "sql"})192 def test_identity_delete_domain_config(self):193 self.admin_domain_config_client.create_domain_config(194 self.domain_id, **self.domain_config())195 self.do_request(196 'delete_domain_group_option_config',197 expected_status=204,198 domain_id=self.domain_id,199 group='ldap',200 option='user_tree_dn')201 self.do_request(202 'delete_domain_group_config',203 expected_status=204,204 domain_id=self.domain_id,205 group='ldap')206 self.do_request(207 'delete_domain_config',208 expected_status=204,209 domain_id=self.domain_id)210class SystemMemberTests(SystemAdminTests):211 credentials = ['system_member', 'system_admin']212 def test_identity_create_domain_config(self):213 self.do_request(214 'create_domain_config',215 expected_status=exceptions.Forbidden,216 domain_id=self.domain_id,217 **self.domain_config())218 def test_identity_update_domain_config(self):219 self.admin_domain_config_client.create_domain_config(220 self.domain_id, **self.domain_config())221 self.addCleanup(222 self.admin_domain_config_client.delete_domain_config,223 self.domain_id)224 self.do_request(225 'update_domain_group_config',226 expected_status=exceptions.Forbidden,227 domain_id=self.domain_id,228 group='ldap',229 ldap={'url': 'ldaps://myldap.com:636/',230 'user_tree_dn': 'ou=People,dc=my_new_root,dc=org'})231 self.do_request(232 'update_domain_group_option_config',233 expected_status=exceptions.Forbidden,234 domain_id=self.domain_id,235 group='ldap',236 option='user_tree_dn',237 user_tree_dn='ou=Aliens,dc=my_new_root,dc=org')238 # test changing the entire config last239 self.do_request(240 'update_domain_config',241 expected_status=exceptions.Forbidden,242 domain_id=self.domain_id,243 identity={"driver": "sql"})244 def test_identity_delete_domain_config(self):245 self.admin_domain_config_client.create_domain_config(246 self.domain_id, **self.domain_config())247 self.do_request(248 'delete_domain_group_option_config',249 expected_status=exceptions.Forbidden,250 domain_id=self.domain_id,251 group='ldap',252 option='user_tree_dn')253 self.do_request(254 'delete_domain_group_config',255 expected_status=exceptions.Forbidden,256 domain_id=self.domain_id,257 group='ldap')258 self.do_request(...
test_domain_configuration_rbac.py
Source:test_domain_configuration_rbac.py
...121 self.domain_id, 'identity', 'driver', driver='ldap')['config']122 @rbac_rule_validation.action(service="keystone",123 rule="identity:delete_domain_config")124 @decorators.idempotent_id('6bdaecd4-0843-4ed6-ab64-3a57ab0cd117')125 def test_delete_domain_config(self):126 self.rbac_utils.switch_role(self, toggle_rbac_role=True)127 self.domain_config_client.delete_domain_config(self.domain_id)128 @decorators.idempotent_id('f479694b-df02-4d5a-88b6-c8b52f9341eb')129 @rbac_rule_validation.action(service="keystone",130 rule="identity:delete_domain_config")131 def test_delete_domain_group_config(self):132 self.rbac_utils.switch_role(self, toggle_rbac_role=True)133 self.domain_config_client.delete_domain_group_config(self.domain_id,134 'identity')135 @decorators.idempotent_id('f594bde3-31c9-414f-922d-0ddafdc0ca40')136 @rbac_rule_validation.action(service="keystone",137 rule="identity:delete_domain_config")138 def test_delete_domain_group_option_config(self):139 self.rbac_utils.switch_role(self, toggle_rbac_role=True)140 self.domain_config_client.delete_domain_group_option_config(141 self.domain_id, 'identity', 'driver')
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!!