How to use _list_assertions method in tempest

Best Python code snippet using tempest_python

test_roles.py

Source:test_roles.py Github

copy

Full Screen

...57 resp[4], _ = cls.v3_client.delete_domain(cls.domain['id'])58 for r in resp:59 assert r['status'] == '204', "Expected: %s" % r['status']60 super(RolesV3TestJSON, cls).tearDownClass()61 def _list_assertions(self, resp, body, fetched_role_ids, role_id):62 self.assertEqual(resp['status'], '200')63 self.assertEqual(len(body), 1)64 self.assertIn(role_id, fetched_role_ids)65 @attr(type='smoke')66 def test_role_create_update_get(self):67 r_name = data_utils.rand_name('Role-')68 resp, role = self.v3_client.create_role(r_name)69 self.addCleanup(self.v3_client.delete_role, role['id'])70 self.assertEqual(resp['status'], '201')71 self.assertIn('name', role)72 self.assertEqual(role['name'], r_name)73 new_name = data_utils.rand_name('NewRole-')74 resp, updated_role = self.v3_client.update_role(new_name, role['id'])75 self.assertEqual(resp['status'], '200')76 self.assertIn('name', updated_role)77 self.assertIn('id', updated_role)78 self.assertIn('links', updated_role)79 self.assertNotEqual(r_name, updated_role['name'])80 resp, new_role = self.v3_client.get_role(role['id'])81 self.assertEqual(resp['status'], '200')82 self.assertEqual(new_name, new_role['name'])83 self.assertEqual(updated_role['id'], new_role['id'])84 @attr(type='smoke')85 def test_grant_list_revoke_role_to_user_on_project(self):86 resp, _ = self.v3_client.assign_user_role_on_project(87 self.project['id'], self.user_body['id'], self.role['id'])88 self.assertEqual(resp['status'], '204')89 resp, roles = self.v3_client.list_user_roles_on_project(90 self.project['id'], self.user_body['id'])91 for i in roles:92 self.fetched_role_ids.append(i['id'])93 self._list_assertions(resp, roles, self.fetched_role_ids,94 self.role['id'])95 resp, _ = self.v3_client.revoke_role_from_user_on_project(96 self.project['id'], self.user_body['id'], self.role['id'])97 self.assertEqual(resp['status'], '204')98 @attr(type='smoke')99 def test_grant_list_revoke_role_to_user_on_domain(self):100 resp, _ = self.v3_client.assign_user_role_on_domain(101 self.domain['id'], self.user_body['id'], self.role['id'])102 self.assertEqual(resp['status'], '204')103 resp, roles = self.v3_client.list_user_roles_on_domain(104 self.domain['id'], self.user_body['id'])105 for i in roles:106 self.fetched_role_ids.append(i['id'])107 self._list_assertions(resp, roles, self.fetched_role_ids,108 self.role['id'])109 resp, _ = self.v3_client.revoke_role_from_user_on_domain(110 self.domain['id'], self.user_body['id'], self.role['id'])111 self.assertEqual(resp['status'], '204')112 @attr(type='smoke')113 def test_grant_list_revoke_role_to_group_on_project(self):114 resp, _ = self.v3_client.assign_group_role_on_project(115 self.project['id'], self.group_body['id'], self.role['id'])116 self.assertEqual(resp['status'], '204')117 resp, roles = self.v3_client.list_group_roles_on_project(118 self.project['id'], self.group_body['id'])119 for i in roles:120 self.fetched_role_ids.append(i['id'])121 self._list_assertions(resp, roles, self.fetched_role_ids,122 self.role['id'])123 resp, _ = self.v3_client.revoke_role_from_group_on_project(124 self.project['id'], self.group_body['id'], self.role['id'])125 self.assertEqual(resp['status'], '204')126 @attr(type='smoke')127 def test_grant_list_revoke_role_to_group_on_domain(self):128 resp, _ = self.v3_client.assign_group_role_on_domain(129 self.domain['id'], self.group_body['id'], self.role['id'])130 self.assertEqual(resp['status'], '204')131 resp, roles = self.v3_client.list_group_roles_on_domain(132 self.domain['id'], self.group_body['id'])133 for i in roles:134 self.fetched_role_ids.append(i['id'])135 self._list_assertions(resp, roles, self.fetched_role_ids,136 self.role['id'])137 resp, _ = self.v3_client.revoke_role_from_group_on_domain(138 self.domain['id'], self.group_body['id'], self.role['id'])139 self.assertEqual(resp['status'], '204')140class RolesV3TestXML(RolesV3TestJSON):...

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