Best Python code snippet using tempest_python
test_roles.py
Source:test_roles.py  
...184    @decorators.idempotent_id('c888fe4f-8018-48db-b959-542225c1b4b6')185    def test_grant_list_revoke_role_to_group_on_system(self):186        self.roles_client.create_group_role_on_system(187            self.group_body['id'], self.role['id'])188        roles = self.roles_client.list_group_roles_on_system(189            self.group_body['id'])['roles']190        self.assertEqual(1, len(roles))191        self.assertEqual(self.role['id'], roles[0]['id'])192        self.roles_client.check_role_from_group_on_system_existence(193            self.group_body['id'], self.role['id'])194        self.roles_client.delete_role_from_group_on_system(195            self.group_body['id'], self.role['id'])196    @decorators.idempotent_id('f5654bcc-08c4-4f71-88fe-05d64e06de94')197    def test_list_roles(self):198        """Test listing roles"""199        # Return a list of all roles200        body = self.roles_client.list_roles()['roles']201        found = [role for role in body if role in self.roles]202        self.assertEqual(len(found), len(self.roles))...test_roles_client.py
Source:test_roles_client.py  
...277            self.FAKE_LIST_ROLES,278            bytes_body,279            domain_id="b344506af7644f6794d9cb316600b020",280            group_id="123")281    def _test_list_group_roles_on_system(self, bytes_body=False):282        self.check_service_client_function(283            self.client.list_group_roles_on_system,284            'tempest.lib.common.rest_client.RestClient.get',285            self.FAKE_LIST_ROLES,286            bytes_body,287            domain_id="b344506af7644f6794d9cb316600b020",288            group_id="123")289    def _test_create_role_inference_rule(self, bytes_body=False):290        self.check_service_client_function(291            self.client.create_role_inference_rule,292            'tempest.lib.common.rest_client.RestClient.put',293            self.FAKE_ROLE_INFERENCE_RULE,294            bytes_body,295            status=201,...roles_client.py
Source:roles_client.py  
...168                              (domain_id, group_id))169        self.expected_success(200, resp.status)170        body = json.loads(body)171        return rest_client.ResponseBody(resp, body)172    def list_group_roles_on_system(self, group_id):173        """list roles of a group on the system."""174        resp, body = self.get('system/groups/%s/roles' % group_id)175        self.expected_success(200, resp.status)176        body = json.loads(body)177        return rest_client.ResponseBody(resp, body)178    def delete_role_from_group_on_project(self, project_id, group_id, role_id):179        """Delete role of a group on a project."""180        resp, body = self.delete('projects/%s/groups/%s/roles/%s' %181                                 (project_id, group_id, role_id))182        self.expected_success(204, resp.status)183        return rest_client.ResponseBody(resp, body)184    def delete_role_from_group_on_domain(self, domain_id, group_id, role_id):185        """Delete role of a group on a domain."""186        resp, body = self.delete('domains/%s/groups/%s/roles/%s' %...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!!
