Best Python code snippet using tempest_python
rbac_base.py
Source:rbac_base.py
...29 if 'admin' not in CONF.auth.tempest_roles:30 raise cls.skipException(31 "%s skipped because tempest roles is not admin" % cls.__name__)32 @classmethod33 def setup_clients(cls):34 super(BaseV2ImageRbacTest, cls).setup_clients()35 cls.auth_provider = cls.os.auth_provider36class BaseNetworkRbacTest(network_base.BaseNetworkTest):37 credentials = ['primary', 'admin']38 @classmethod39 def skip_checks(cls):40 super(BaseNetworkRbacTest, cls).skip_checks()41 if not CONF.rbac.rbac_flag:42 raise cls.skipException(43 "%s skipped as RBAC Flag not enabled" % cls.__name__)44 if 'admin' not in CONF.auth.tempest_roles:45 raise cls.skipException(46 "%s skipped because tempest roles is not admin" % cls.__name__)47 @classmethod48 def setup_clients(cls):49 super(BaseNetworkRbacTest, cls).setup_clients()50 cls.auth_provider = cls.os.auth_provider51class BaseVolumeRbacTest(volume_base.BaseVolumeTest):52 credentials = ['primary', 'admin']53 @classmethod54 def skip_checks(cls):55 super(BaseVolumeRbacTest, cls).skip_checks()56 if not CONF.rbac.rbac_flag:57 raise cls.skipException(58 "%s skipped as RBAC Flag not enabled" % cls.__name__)59 if 'admin' not in CONF.auth.tempest_roles:60 raise cls.skipException(61 "%s skipped because tempest roles is not admin" % cls.__name__)62 @classmethod63 def setup_clients(cls):64 super(BaseVolumeRbacTest, cls).setup_clients()65 cls.auth_provider = cls.os.auth_provider66 cls.admin_client = cls.os_adm.agents_client67 cls.volumes_client = cls.os.volumes_client68class BaseV2ComputeRbacTest(compute_base.BaseV2ComputeTest):69 credentials = ['primary', 'admin']70 @classmethod71 def skip_checks(cls):72 super(BaseV2ComputeRbacTest, cls).skip_checks()73 if not CONF.rbac.rbac_flag:74 raise cls.skipException(75 "%s skipped as RBAC Flag not enabled" % cls.__name__)76 if 'admin' not in CONF.auth.tempest_roles:77 raise cls.skipException(78 "%s skipped because tempest roles is not admin" % cls.__name__)79 @classmethod80 def setup_clients(cls):81 super(BaseV2ComputeRbacTest, cls).setup_clients()82 cls.auth_provider = cls.os.auth_provider83class BaseV2ComputeAdminRbacTest(compute_base.BaseV2ComputeAdminTest):84 credentials = ['primary', 'admin']85 @classmethod86 def skip_checks(cls):87 super(BaseV2ComputeAdminRbacTest, cls).skip_checks()88 if not CONF.rbac.rbac_flag:89 raise cls.skipException(90 "%s skipped as RBAC Flag not enabled" % cls.__name__)91 if 'admin' not in CONF.auth.tempest_roles:92 raise cls.skipException(93 "%s skipped because tempest roles is not admin" % cls.__name__)94 @classmethod95 def setup_clients(cls):96 super(BaseV2ComputeAdminRbacTest, cls).setup_clients()...
base.py
Source:base.py
...11 self.identity_client = None12 self.compute_client = None13 self.image_client = None14 self.setup()15 def setup_clients(self):16 self.auth = v3.Password(auth_url=self.CONF.auth.url,17 username=self.CONF.auth.username,18 password=self.CONF.auth.password,19 user_domain_id=self.CONF.auth.user_domain_id,20 project_domain_id=self.CONF.auth.project_domain_id,21 project_name=self.CONF.auth.project_name)22 self.session = session.Session(auth=self.auth)23 self.identity_client = keystoneclient.Client(session=self.session)24 self.compute_client = novaclient.Client(session=self.session, version="2")25 self.image_client = glanceclient.Client(session=self.session, version="2")26 def setup(self):...
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!!