How to use _create_domain_and_config method in tempest

Best Python code snippet using tempest_python

test_domain_configuration.py

Source:test_domain_configuration.py Github

copy

Full Screen

...34 @classmethod35 def setup_clients(cls):36 super(DomainConfigurationTestJSON, cls).setup_clients()37 cls.client = cls.domain_config_client38 def _create_domain_and_config(self, config):39 domain = self.setup_test_domain()40 config = self.client.create_domain_config(domain['id'], **config)[41 'config']42 self.addCleanup(test_utils.call_and_ignore_notfound_exc,43 self.client.delete_domain_config, domain['id'])44 return domain, config45 @decorators.idempotent_id('11a02bf0-6f94-4380-b3b0-c8dc18fc0d22')46 def test_show_default_group_config_and_options(self):47 # The API supports only the identity and ldap groups. For the ldap48 # group, a valid value is url or user_tree_dn. For the identity group,49 # a valid value is driver.50 # Check that the default config has the identity and ldap groups.51 config = self.client.show_default_config_settings()['config']52 self.assertIsInstance(config, dict)53 self.assertIn('identity', config)54 self.assertIn('ldap', config)55 # Check that the identity group is correct.56 identity_config = self.client.show_default_group_config('identity')[57 'config']58 self.assertIsInstance(identity_config, dict)59 self.assertIn('identity', identity_config)60 self.assertIn('driver', identity_config['identity'])61 self.assertIn('list_limit', identity_config['identity'])62 # Show each option for the default domain and identity group.63 for config_opt_name in ['driver', 'list_limit']:64 retrieved_config_opt = self.client.show_default_group_option(65 'identity', config_opt_name)['config']66 self.assertIn(config_opt_name, retrieved_config_opt)67 # Check that the ldap group is correct.68 ldap_config = self.client.show_default_group_config('ldap')['config']69 self.assertIsInstance(ldap_config, dict)70 self.assertIn('ldap', ldap_config)71 # Several valid options exist for ldap group.72 valid_options = ldap_config['ldap'].keys()73 # Show each option for the default domain and ldap group.74 for config_opt_name in valid_options:75 retrieved_config_opt = self.client.show_default_group_option(76 'ldap', config_opt_name)['config']77 self.assertIn(config_opt_name, retrieved_config_opt)78 @decorators.idempotent_id('9e3ff13c-f597-4f01-9377-d6c06c2a1477')79 def test_create_domain_config_and_show_config_groups_and_options(self):80 domain, created_config = self._create_domain_and_config(81 self.custom_config)82 # Check that the entire configuration is correct.83 self.assertEqual(self.custom_config, created_config)84 # Check that each configuration group is correct.85 for group_name in self.custom_config.keys():86 group_cfg = self.client.show_domain_group_config(87 domain['id'], group_name)['config']88 self.assertIn(group_name, group_cfg)89 self.assertEqual(self.custom_config[group_name],90 group_cfg[group_name])91 # Check that each configuration option is correct.92 for opt_name in self.custom_config[group_name].keys():93 group_opt = self.client.show_domain_group_option_config(94 domain['id'], group_name, opt_name)['config']95 self.assertIn(opt_name, group_opt)96 self.assertEqual(self.custom_config[group_name][opt_name],97 group_opt[opt_name])98 @decorators.idempotent_id('7161023e-5dd0-4612-9da0-1bac6ac30b63')99 def test_create_update_and_delete_domain_config(self):100 domain, created_config = self._create_domain_and_config(101 self.custom_config)102 new_config = created_config103 new_config['ldap']['url'] = data_utils.rand_url()104 # Check that the altered configuration is reflected in updated_config.105 updated_config = self.client.update_domain_config(106 domain['id'], **new_config)['config']107 self.assertEqual(new_config, updated_config)108 # Check that showing the domain config shows the altered configuration.109 retrieved_config = self.client.show_domain_config(domain['id'])[110 'config']111 self.assertEqual(new_config, retrieved_config)112 # Check that deleting a configuration works.113 self.client.delete_domain_config(domain['id'])114 self.assertRaises(lib_exc.NotFound, self.client.show_domain_config,115 domain['id'])116 @decorators.idempotent_id('c7510fa2-6661-4170-9c6b-4783a80651e9')117 def test_create_update_and_delete_domain_config_groups_and_opts(self):118 domain, _ = self._create_domain_and_config(self.custom_config)119 # Check that updating configuration groups work.120 new_driver = data_utils.rand_name('driver')121 new_limit = data_utils.rand_int_id(0, 100)122 new_group_config = {'identity': {'driver': new_driver,123 'list_limit': new_limit}}124 updated_config = self.client.update_domain_group_config(125 domain['id'], 'identity', **new_group_config)['config']126 self.assertEqual(new_driver, updated_config['identity']['driver'])127 self.assertEqual(new_limit, updated_config['identity']['list_limit'])128 # Check that updating individual configuration group options work.129 new_driver = data_utils.rand_name('driver')130 updated_config = self.client.update_domain_group_option_config(131 domain['id'], 'identity', 'driver', driver=new_driver)['config']132 self.assertEqual(new_driver, updated_config['identity']['driver'])...

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