How to use list_tenant_users method in tempest

Best Python code snippet using tempest_python

test_tenants.py

Source:test_tenants.py Github

copy

Full Screen

...148 self.user = self.create_user(user_password=password).json['user']149 self.user['password'] = password150 role = self.create_role().json['role']151 self.grant_role_to_user(self.user['id'], role['id'], self.tenant['id'])152 def test_list_tenant_users(self):153 user = self.list_tenant_users(self.tenant['id'],154 assert_status=200).json['users'][0]155 self.assertEquals(user['name'], self.user['name'])156 def test_list_tenant_users_xml(self):157 r = self.list_tenant_users(self.tenant['id'],158 assert_status=200, headers={159 "Accept": "application/xml"})160 self.assertEquals(r.xml.tag, '{%s}users' % self.xmlns)161 users = r.xml.findall('{%s}user' % self.xmlns)162 for user in users:163 self.assertEqual(user.get('name'), self.user['name'])164 def test_list_tenant_users_expired_token(self):165 self.admin_token = self.expired_admin_token166 self.list_tenant_users(self.tenant['id'], assert_status=403)167 def test_list_tenant_users_disabled_token(self):168 self.admin_token = self.disabled_admin_token169 self.list_tenant_users(self.tenant['id'], assert_status=403)170 def test_list_tenant_users_missing_token(self):171 self.admin_token = ''172 self.list_tenant_users(self.tenant['id'], assert_status=401)173 def test_list_tenant_users_invalid_token(self):174 self.admin_token = common.unique_str()175 self.list_tenant_users(self.tenant['id'], assert_status=401)176class GetTenantUsersByRoleTest(TenantTest):177 def setUp(self, *args, **kwargs):178 super(TenantTest, self).setUp(*args, **kwargs)179 self.tenant = self.create_tenant().json['tenant']180 password = common.unique_str()181 self.user = self.create_user(user_password=password).json['user']182 self.user['password'] = password183 self.role = self.create_role().json['role']184 self.grant_role_to_user(self.user['id'],185 self.role['id'], self.tenant['id'])186 def test_list_tenant_users(self):187 user = self.list_tenant_users(self.tenant['id'],188 self.role['id'], assert_status=200).json['users'][0]189 self.assertEquals(user['name'], self.user['name'])190 def test_list_tenant_users_xml(self):191 r = self.list_tenant_users(self.tenant['id'],192 self.role['id'], assert_status=200, headers={193 "Accept": "application/xml"})194 self.assertEquals(r.xml.tag, '{%s}users' % self.xmlns)195 users = r.xml.findall('{%s}user' % self.xmlns)196 for user in users:197 self.assertEqual(user.get('name'), self.user['name'])198 def test_list_tenant_users_expired_token(self):199 self.admin_token = self.expired_admin_token200 self.list_tenant_users(self.tenant['id'],201 self.role['id'], assert_status=403)202 def test_list_tenant_users_disabled_token(self):203 self.admin_token = self.disabled_admin_token204 self.list_tenant_users(self.tenant['id'],205 self.role['id'], assert_status=403)206 def test_list_tenant_users_missing_token(self):207 self.admin_token = ''208 self.list_tenant_users(self.tenant['id'],209 self.role['id'], assert_status=401)210 def test_list_tenant_users_invalid_token(self):211 self.admin_token = common.unique_str()212 self.list_tenant_users(self.tenant['id'],213 self.role['id'], assert_status=401)214class GetTenantByNameTest(TenantTest):215 def setUp(self, *args, **kwargs):216 super(TenantTest, self).setUp(*args, **kwargs)217 self.tenant = self.create_tenant().json['tenant']218 def test_get_tenant(self):219 self.fetch_tenant_by_name(self.tenant['name'], assert_status=200)220 def test_get_tenant_xml(self):221 self.fetch_tenant_by_name(222 self.tenant['name'], assert_status=200, headers={223 "Accept": "application/xml"})224 def test_get_tenant_not_found(self):225 self.fetch_tenant_by_name(assert_status=404)226 def test_get_tenant_not_found_xml(self):...

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