How to use _append_role method in tempest

Best Python code snippet using tempest_python

accounts.py

Source:accounts.py Github

copy

Full Screen

...45 self.accounts_dir = os.path.join(CONF.oslo_concurrency.lock_path,46 'test_accounts')47 self.isolated_creds = {}48 @classmethod49 def _append_role(cls, role, account_hash, hash_dict):50 if role in hash_dict['roles']:51 hash_dict['roles'][role].append(account_hash)52 else:53 hash_dict['roles'][role] = [account_hash]54 return hash_dict55 @classmethod56 def get_hash_dict(cls, accounts):57 hash_dict = {'roles': {}, 'creds': {}}58 # Loop over the accounts read from the yaml file59 for account in accounts:60 roles = []61 types = []62 if 'roles' in account:63 roles = account.pop('roles')64 if 'types' in account:65 types = account.pop('types')66 temp_hash = hashlib.md5()67 temp_hash.update(str(account))68 temp_hash_key = temp_hash.hexdigest()69 hash_dict['creds'][temp_hash_key] = account70 for role in roles:71 hash_dict = cls._append_role(role, temp_hash_key,72 hash_dict)73 # If types are set for the account append the matching role74 # subdict with the hash75 for type in types:76 if type == 'admin':77 hash_dict = cls._append_role(CONF.identity.admin_role,78 temp_hash_key, hash_dict)79 elif type == 'operator':80 hash_dict = cls._append_role(81 CONF.object_storage.operator_role, temp_hash_key,82 hash_dict)83 elif type == 'reseller_admin':84 hash_dict = cls._append_role(85 CONF.object_storage.reseller_admin_role,86 temp_hash_key,87 hash_dict)88 return hash_dict89 def is_multi_user(self):90 # Default credentials is not a valid option with locking Account91 if self.use_default_creds:92 raise exceptions.InvalidConfiguration(93 "Account file %s doesn't exist" % CONF.auth.test_accounts_file)94 else:95 return len(self.hash_dict['creds']) > 196 def is_multi_tenant(self):97 return self.is_multi_user()98 def _create_hash_file(self, hash_string):...

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