How to use _test_create_user method in tempest

Best Python code snippet using tempest_python

test_authorization.py

Source:test_authorization.py Github

copy

Full Screen

...152 self.role = self.identity_v1.Role.create(153 params,154 metadata=(('token', self.owner_token),))155 self.roles.append(self.role)156 def _test_create_user(self, user_id=None):157 if user_id is None:158 user_id = utils.random_string() + '@mz.co.kr'159 self.user_password = utils.generate_password()160 params = {161 'user_id': user_id,162 'password': self.user_password,163 'name': utils.random_string(),164 'domain_id': self.domain.domain_id165 }166 self.user = self.identity_v1.User.create(167 params,168 metadata=(('token', self.owner_token),)169 )170 self.users.append(self.user)171 def _test_create_project_group(self, project_group_id=None):172 params = {173 'name': utils.random_string(),174 'domain_id': self.domain.domain_id,175 'parent_project_group_id': project_group_id176 }177 self.project_group = self.identity_v1.ProjectGroup.create(178 params,179 metadata=(('token', self.owner_token),)180 )181 self.project_groups.append(self.project_group)182 def _test_create_project(self, project_group_id=None):183 if project_group_id is None:184 self._test_create_project_group()185 params = {186 'name': utils.random_string(),187 'domain_id': self.domain.domain_id188 }189 if project_group_id is None:190 params['project_group_id'] = self.project_group.project_group_id191 else:192 params['project_group_id'] = project_group_id193 self.project = self.identity_v1.Project.create(194 params,195 metadata=(('token', self.owner_token),)196 )197 self.projects.append(self.project)198 def _test_create_domain_role_binding(self, permissions=None):199 if permissions is None:200 permissions = ['*']201 self._test_create_policy(permissions)202 self._test_create_role([{203 'policy_type': 'CUSTOM',204 'policy_id': self.policy.policy_id}], 'DOMAIN')205 params = {206 'resource_type': 'identity.User',207 'resource_id': self.user.user_id,208 'domain_id': self.domain.domain_id,209 'role_id': self.role.role_id210 }211 self.role_binding = self.identity_v1.RoleBinding.create(212 params,213 metadata=(('token', self.owner_token),)214 )215 self.role_bindings.append(self.role_binding)216 self._print_data(self.user, '_test_create_domain_role_binding')217 def _test_create_system_role_binding(self, permissions=None):218 if permissions is None:219 permissions = ['*']220 self._test_create_policy(permissions)221 self._test_create_role([{222 'policy_type': 'CUSTOM',223 'policy_id': self.policy.policy_id}], 'SYSTEM')224 params = {225 'resource_type': 'identity.User',226 'resource_id': self.user.user_id,227 'domain_id': self.domain.domain_id,228 'role_id': self.role.role_id229 }230 self.role_binding = self.identity_v1.RoleBinding.create(231 params,232 metadata=(('token', self.owner_token),)233 )234 self.role_bindings.append(self.role_binding)235 self._print_data(self.user, '_test_create_system_role_binding')236 def _test_create_project_role_binding(self, project_id=None, project_group_id=None, permissions=None):237 if permissions is None:238 permissions = ['*']239 self._test_create_policy(permissions)240 self._test_create_role(241 [{242 'policy_type': 'CUSTOM',243 'policy_id': self.policy.policy_id244 }], 'PROJECT'245 )246 params = {247 'resource_type': 'identity.User',248 'resource_id': self.user.user_id,249 'domain_id': self.domain.domain_id,250 'role_id': self.role.role_id,251 'project_id': project_id,252 'project_group_id': project_group_id253 }254 self.role_binding = self.identity_v1.RoleBinding.create(255 params,256 metadata=(('token', self.owner_token),)257 )258 self.role_bindings.append(self.role_binding)259 self._print_data(self.user, '_test_create_project_role_binding')260 def _test_issue_user_token(self):261 token_params = {262 'user_type': 'USER',263 'user_id': self.user.user_id,264 'credentials': {265 'password': self.user_password266 },267 'domain_id': self.domain.domain_id268 }269 response = self.identity_v1.Token.issue(token_params)270 self.user_token = response.access_token271 def test_authorization_verify_no_roles(self):272 self._test_create_user()273 self._test_issue_user_token()274 params = {275 'service': 'identity',276 'resource': 'User',277 'verb': 'list',278 'scope': 'DOMAIN'279 }280 with self.assertRaisesRegex(Exception, 'ERROR_PERMISSION_DENIED'):281 self.identity_v1.Authorization.verify(282 params,283 metadata=(('token', self.user_token),))284 def test_authorization_verify_no_roles_access_default_permissions_my_id(self):285 self._test_create_user()286 self._test_issue_user_token()287 params = {288 'service': 'identity',289 'resource': 'User',290 'verb': 'get',291 'scope': 'DOMAIN',292 'user_id': self.user.user_id293 }294 response = self.identity_v1.Authorization.verify(295 params,296 metadata=(('token', self.user_token),))297 self._print_data(response, 'test_authorization_verify_no_roles_access_default_permissions')298 self.assertEqual('USER', response.role_type)299 def test_authorization_verify_no_roles_access_default_permissions_other_id(self):300 self._test_create_user()301 self._test_issue_user_token()302 params = {303 'service': 'identity',304 'resource': 'User',305 'verb': 'get',306 'scope': 'DOMAIN',307 'user_id': utils.random_string() + '@mz.co.kr'308 }309 with self.assertRaisesRegex(Exception, 'ERROR_PERMISSION_DENIED'):310 self.identity_v1.Authorization.verify(311 params,312 metadata=(('token', self.user_token),))313 def test_authorization_verify_domain_role_no_permissions(self):314 self._test_create_user()315 self._test_create_domain_role_binding(['identity.Domain.*'])316 self._test_issue_user_token()317 params = {318 'service': 'identity',319 'resource': 'User',320 'verb': 'list',321 'scope': 'DOMAIN'322 }323 with self.assertRaisesRegex(Exception, 'ERROR_PERMISSION_DENIED'):324 self.identity_v1.Authorization.verify(325 params,326 metadata=(('token', self.user_token),))327 def test_authorization_verify_domain_role_with_no_domain_id(self):328 self._test_create_user()329 self._test_create_domain_role_binding()330 self._test_issue_user_token()331 params = {332 'service': 'identity',333 'resource': 'User',334 'verb': 'list',335 'scope': 'DOMAIN'336 }337 response = self.identity_v1.Authorization.verify(338 params,339 metadata=(('token', self.user_token),))340 self._print_data(response, 'test_authorization_verify_domain_role_with_no_domain_id')341 self.assertEqual('DOMAIN', response.role_type)342 def test_authorization_verify_domain_role_with_same_domain_id(self):343 self._test_create_user()344 self._test_create_domain_role_binding()345 self._test_issue_user_token()346 params = {347 'service': 'identity',348 'resource': 'User',349 'verb': 'list',350 'scope': 'DOMAIN',351 'domain_id': self.domain.domain_id352 }353 response = self.identity_v1.Authorization.verify(354 params,355 metadata=(('token', self.user_token),))356 self._print_data(response, 'test_authorization_verify_domain_role_with_same_domain_id')357 self.assertEqual('DOMAIN', response.role_type)358 def test_authorization_verify_domain_role_with_other_domain_id(self):359 self._test_create_user()360 self._test_create_domain_role_binding()361 self._test_issue_user_token()362 params = {363 'service': 'identity',364 'resource': 'User',365 'verb': 'list',366 'scope': 'DOMAIN',367 'domain_id': utils.generate_id('domain')368 }369 with self.assertRaisesRegex(Exception, 'ERROR_PERMISSION_DENIED'):370 self.identity_v1.Authorization.verify(371 params,372 metadata=(('token', self.user_token),))373 def test_authorization_verify_system_role_no_permissions(self):374 self._test_create_user()375 self._test_create_domain_role_binding(['identity.Domain.get_public_key'])376 self._test_issue_user_token()377 params = {378 'service': 'identity',379 'resource': 'User',380 'verb': 'list',381 'scope': 'DOMAIN'382 }383 with self.assertRaisesRegex(Exception, 'ERROR_PERMISSION_DENIED'):384 self.identity_v1.Authorization.verify(385 params,386 metadata=(('token', self.user_token),))387 def test_authorization_verify_domain_role_access_system_api(self):388 self._test_create_user()389 self._test_create_domain_role_binding()390 self._test_issue_user_token()391 params = {392 'service': 'identity',393 'resource': 'User',394 'verb': 'list',395 'scope': 'SYSTEM',396 'domain_id': utils.generate_id('domain')397 }398 # with self.assertRaisesRegex(Exception, 'ERROR_PERMISSION_DENIED'):399 # self.identity_v1.Authorization.verify(400 # params,401 # metadata=(('token', self.user_token),))402 def test_authorization_verify_domain_role_access_project_api_not_in_project(self):403 self._test_create_user()404 self._test_create_domain_role_binding()405 self._test_issue_user_token()406 params = {407 'service': 'identity',408 'resource': 'User',409 'verb': 'list',410 'scope': 'PROJECT',411 'project_id': utils.generate_id('project')412 }413 response = self.identity_v1.Authorization.verify(414 params,415 metadata=(('token', self.user_token),))416 self._print_data(response, 'test_authorization_verify_domain_role_access_project_api_not_in_project')417 self.assertEqual('DOMAIN', response.role_type)418 def test_authorization_verify_domain_role_access_project_api_in_project_has_permissions(self):419 self._test_create_user()420 self._test_create_domain_role_binding()421 self._test_create_project()422 self._test_create_project_role_binding(project_id=self.project.project_id,423 permissions=['identity.User.*'])424 self._test_issue_user_token()425 params = {426 'service': 'identity',427 'resource': 'User',428 'verb': 'list',429 'scope': 'PROJECT',430 'project_id': self.project.project_id431 }432 response = self.identity_v1.Authorization.verify(433 params,434 metadata=(('token', self.user_token),))435 self._print_data(response, 'test_authorization_verify_domain_role_access_project_api_in_project_has_permissions')436 self.assertEqual('DOMAIN', response.role_type)437 def test_authorization_verify_domain_role_access_project_api_in_project_group_has_permissions(self):438 self._test_create_user()439 self._test_create_domain_role_binding()440 self._test_create_project()441 self._test_create_project_role_binding(project_group_id=self.project_group.project_group_id,442 permissions=['identity.User.*'])443 self._test_issue_user_token()444 params = {445 'service': 'identity',446 'resource': 'User',447 'verb': 'list',448 'scope': 'PROJECT',449 'project_id': self.project.project_id450 }451 response = self.identity_v1.Authorization.verify(452 params,453 metadata=(('token', self.user_token),))454 self._print_data(response, 'test_authorization_verify_domain_role_access_project_api_in_project_group_has_permissions')455 self.assertEqual('DOMAIN', response.role_type)456 def test_authorization_verify_domain_role_access_project_api_override_no_permissions(self):457 self._test_create_user()458 self._test_create_domain_role_binding()459 self._test_create_project()460 self._test_create_project_role_binding(project_group_id=self.project_group.project_group_id,461 permissions=['identity.User.*'])462 self._test_create_project_role_binding(project_id=self.project.project_id,463 permissions=['identity.Domain.*'])464 self._test_issue_user_token()465 params = {466 'service': 'identity',467 'resource': 'User',468 'verb': 'list',469 'scope': 'PROJECT',470 'project_id': self.project.project_id471 }472 with self.assertRaisesRegex(Exception, 'ERROR_PERMISSION_DENIED'):473 self.identity_v1.Authorization.verify(474 params,475 metadata=(('token', self.user_token),))476 def test_authorization_verify_domain_role_access_project_api_in_project_no_permissions(self):477 self._test_create_user()478 self._test_create_domain_role_binding()479 self._test_create_project()480 self._test_create_project_role_binding(project_id=self.project.project_id,481 permissions=['identity.Domain.*'])482 self._test_issue_user_token()483 params = {484 'service': 'identity',485 'resource': 'User',486 'verb': 'list',487 'scope': 'PROJECT',488 'project_id': self.project.project_id489 }490 with self.assertRaisesRegex(Exception, 'ERROR_PERMISSION_DENIED'):491 self.identity_v1.Authorization.verify(492 params,493 metadata=(('token', self.user_token),))494 def test_authorization_verify_system_role_with_no_domain_id(self):495 self._test_create_user()496 self._test_create_system_role_binding()497 self._test_issue_user_token()498 params = {499 'service': 'identity',500 'resource': 'User',501 'verb': 'list',502 'scope': 'SYSTEM'503 }504 response = self.identity_v1.Authorization.verify(505 params,506 metadata=(('token', self.user_token),))507 self._print_data(response, 'test_authorization_verify_system_role_with_no_domain_id')508 self.assertEqual('SYSTEM', response.role_type)509 def test_authorization_verify_system_role_with_other_domain_id(self):510 self._test_create_user()511 self._test_create_system_role_binding()512 self._test_issue_user_token()513 params = {514 'service': 'identity',515 'resource': 'User',516 'verb': 'list',517 'scope': 'SYSTEM',518 'domain_id': utils.generate_id('domain')519 }520 response = self.identity_v1.Authorization.verify(521 params,522 metadata=(('token', self.user_token),))523 self._print_data(response, 'test_authorization_verify_system_role_with_other_domain_id')524 self.assertEqual('SYSTEM', response.role_type)525 def test_authorization_verify_system_role_access_domain_api(self):526 self._test_create_user()527 self._test_create_system_role_binding()528 self._test_issue_user_token()529 params = {530 'service': 'identity',531 'resource': 'User',532 'verb': 'list',533 'scope': 'DOMAIN',534 'domain_id': utils.generate_id('domain')535 }536 response = self.identity_v1.Authorization.verify(537 params,538 metadata=(('token', self.user_token),))539 self._print_data(response, 'test_authorization_verify_system_role_access_domain_api')540 self.assertEqual('SYSTEM', response.role_type)541 def test_authorization_verify_system_role_access_project_api(self):542 self._test_create_user()543 self._test_create_system_role_binding()544 self._test_issue_user_token()545 params = {546 'service': 'identity',547 'resource': 'User',548 'verb': 'list',549 'scope': 'PROJECT',550 'domain_id': utils.generate_id('domain')551 }552 response = self.identity_v1.Authorization.verify(553 params,554 metadata=(('token', self.user_token),))555 self._print_data(response, 'test_authorization_verify_system_role_access_project_api')556 self.assertEqual('SYSTEM', response.role_type)557 def test_authorization_verify_project_role_no_permissions(self):558 self._test_create_user()559 self._test_create_project()560 self._test_create_project_role_binding(project_id=self.project.project_id, permissions=['identity.Domain.*'])561 self._test_issue_user_token()562 params = {563 'service': 'identity',564 'resource': 'User',565 'verb': 'list',566 'scope': 'DOMAIN'567 }568 with self.assertRaisesRegex(Exception, 'ERROR_PERMISSION_DENIED'):569 self.identity_v1.Authorization.verify(570 params,571 metadata=(('token', self.user_token),))572 def test_authorization_verify_project_role_with_no_project_id(self):573 self._test_create_user()574 self._test_create_project()575 self._test_create_project_role_binding(project_id=self.project.project_id)576 self._test_issue_user_token()577 params = {578 'service': 'identity',579 'resource': 'User',580 'verb': 'list',581 'scope': 'PROJECT'582 }583 response = self.identity_v1.Authorization.verify(584 params,585 metadata=(('token', self.user_token),))586 self._print_data(response, 'test_authorization_verify_project_role_with_no_project_id')587 self.assertEqual('PROJECT', response.role_type)588 def test_authorization_verify_project_role_with_no_project_id_require_project_id(self):589 self._test_create_user()590 self._test_create_project()591 self._test_create_project_role_binding(project_id=self.project.project_id)592 self._test_issue_user_token()593 params = {594 'service': 'identity',595 'resource': 'User',596 'verb': 'list',597 'scope': 'PROJECT',598 'require_project_id': True599 }600 with self.assertRaisesRegex(Exception, 'ERROR_PERMISSION_DENIED'):601 self.identity_v1.Authorization.verify(602 params,603 metadata=(('token', self.user_token),))604 def test_authorization_verify_project_role_with_no_project_group_id_require_project_group_id(self):605 self._test_create_user()606 self._test_create_project()607 self._test_create_project_role_binding(project_id=self.project.project_id)608 self._test_issue_user_token()609 params = {610 'service': 'identity',611 'resource': 'User',612 'verb': 'list',613 'scope': 'PROJECT',614 'require_project_group_id': True615 }616 with self.assertRaisesRegex(Exception, 'ERROR_PERMISSION_DENIED'):617 self.identity_v1.Authorization.verify(618 params,619 metadata=(('token', self.user_token),))620 def test_authorization_verify_project_role_with_no_domain_id(self):621 self._test_create_user()622 self._test_create_project()623 self._test_create_project_role_binding(project_id=self.project.project_id)624 self._test_issue_user_token()625 params = {626 'service': 'identity',627 'resource': 'User',628 'verb': 'list',629 'scope': 'PROJECT',630 'project_id': self.project.project_id631 }632 response = self.identity_v1.Authorization.verify(633 params,634 metadata=(('token', self.user_token),))635 self._print_data(response, 'test_authorization_verify_project_role_with_no_domain_id')636 self.assertEqual('PROJECT', response.role_type)637 def test_authorization_verify_project_role_with_other_domain_id(self):638 self._test_create_user()639 self._test_create_project()640 self._test_create_project_role_binding(project_id=self.project.project_id)641 self._test_issue_user_token()642 params = {643 'service': 'identity',644 'resource': 'User',645 'verb': 'list',646 'scope': 'PROJECT',647 'domain_id': utils.generate_id('domain'),648 'project_id': self.project.project_id649 }650 with self.assertRaisesRegex(Exception, 'ERROR_PERMISSION_DENIED'):651 self.identity_v1.Authorization.verify(652 params,653 metadata=(('token', self.user_token),))654 def test_authorization_verify_project_role_with_other_project_id(self):655 self._test_create_user()656 self._test_create_project()657 self._test_create_project_role_binding(project_id=self.project.project_id)658 self._test_issue_user_token()659 params = {660 'service': 'identity',661 'resource': 'User',662 'verb': 'list',663 'scope': 'PROJECT',664 'domain_id': self.domain.domain_id,665 'project_id': utils.generate_id('project')666 }667 with self.assertRaisesRegex(Exception, 'ERROR_PERMISSION_DENIED'):668 self.identity_v1.Authorization.verify(669 params,670 metadata=(('token', self.user_token),))671 def test_authorization_verify_project_role_with_same_project_id(self):672 self._test_create_user()673 self._test_create_project()674 self._test_create_project_role_binding(project_id=self.project.project_id)675 self._test_issue_user_token()676 params = {677 'service': 'identity',678 'resource': 'User',679 'verb': 'list',680 'scope': 'PROJECT',681 'project_id': self.project.project_id682 }683 response = self.identity_v1.Authorization.verify(684 params,685 metadata=(('token', self.user_token),))686 self._print_data(response, 'test_authorization_verify_project_role_with_same_project_id')687 self.assertEqual('PROJECT', response.role_type)688 def test_authorization_verify_project_role_with_same_project_group_id(self):689 self._test_create_user()690 self._test_create_project()691 self._test_create_project_role_binding(project_group_id=self.project_group.project_group_id)692 self._test_issue_user_token()693 params = {694 'service': 'identity',695 'resource': 'User',696 'verb': 'list',697 'scope': 'PROJECT',698 'project_group_id': self.project_group.project_group_id699 }700 response = self.identity_v1.Authorization.verify(701 params,702 metadata=(('token', self.user_token),))703 self._print_data(response, 'test_authorization_verify_project_role_with_same_project_group_id')704 self.assertEqual('PROJECT', response.role_type)705 def test_authorization_verify_project_role_with_child_project_group_id(self):706 self._test_create_user()707 self._test_create_project_group()708 self._test_create_project_group(self.project_group.project_group_id)709 self._test_create_project_group(self.project_group.project_group_id)710 self._test_create_project(self.project_group.project_group_id)711 self._test_create_project(self.project_group.project_group_id)712 self._test_create_project(self.project_group.project_group_id)713 self._test_create_project_role_binding(project_group_id=self.project_groups[0].project_group_id,714 permissions=['identity.User.*'])715 self._test_issue_user_token()716 params = {717 'service': 'identity',718 'resource': 'User',719 'verb': 'list',720 'scope': 'PROJECT',721 'project_group_id': self.project_group.project_group_id722 }723 response = self.identity_v1.Authorization.verify(724 params,725 metadata=(('token', self.user_token),))726 self._print_data(response, 'test_authorization_verify_project_role_with_no_domain_id_and_project_id')727 self.assertEqual('PROJECT', response.role_type)728 def test_authorization_verify_project_role_with_child_project_id(self):729 self._test_create_user()730 self._test_create_project_group()731 self._test_create_project_group(self.project_group.project_group_id)732 self._test_create_project_group(self.project_group.project_group_id)733 self._test_create_project(self.project_group.project_group_id)734 self._test_create_project(self.project_group.project_group_id)735 self._test_create_project(self.project_group.project_group_id)736 self._test_create_project_role_binding(project_group_id=self.project_groups[0].project_group_id,737 permissions=['identity.User.*'])738 self._test_issue_user_token()739 params = {740 'service': 'identity',741 'resource': 'User',742 'verb': 'list',743 'scope': 'PROJECT',744 'project_id': self.project.project_id745 }746 response = self.identity_v1.Authorization.verify(747 params,748 metadata=(('token', self.user_token),))749 self._print_data(response, 'test_authorization_verify_project_role_with_no_domain_id_and_project_id')750 self.assertEqual('PROJECT', response.role_type)751 def test_authorization_verify_project_role_with_child_override_no_permissions_project_group(self):752 self._test_create_user()753 self._test_create_project_group()754 self._test_create_project_group(self.project_group.project_group_id)755 self._test_create_project_group(self.project_group.project_group_id)756 self._test_create_project(self.project_group.project_group_id)757 self._test_create_project(self.project_group.project_group_id)758 self._test_create_project(self.project_group.project_group_id)759 self._test_create_project_role_binding(project_group_id=self.project_groups[0].project_group_id,760 permissions=['identity.User.*'])761 self._test_create_project_role_binding(project_group_id=self.project_group.project_group_id,762 permissions=['identity.Domain.*'])763 self._test_issue_user_token()764 params = {765 'service': 'identity',766 'resource': 'User',767 'verb': 'list',768 'scope': 'PROJECT',769 'project_id': self.project.project_id770 }771 with self.assertRaisesRegex(Exception, 'ERROR_PERMISSION_DENIED'):772 self.identity_v1.Authorization.verify(773 params,774 metadata=(('token', self.user_token),))775 def test_authorization_verify_project_role_with_child_override_no_permissions_project(self):776 self._test_create_user()777 self._test_create_project_group()778 self._test_create_project_group(self.project_group.project_group_id)779 self._test_create_project_group(self.project_group.project_group_id)780 self._test_create_project(self.project_group.project_group_id)781 self._test_create_project(self.project_group.project_group_id)782 self._test_create_project(self.project_group.project_group_id)783 self._test_create_project_role_binding(project_group_id=self.project_groups[0].project_group_id,784 permissions=['identity.User.*'])785 self._test_create_project_role_binding(project_id=self.project.project_id,786 permissions=['identity.Domain.*'])787 self._test_issue_user_token()788 params = {789 'service': 'identity',790 'resource': 'User',791 'verb': 'list',792 'scope': 'PROJECT',793 'project_id': self.project.project_id794 }795 with self.assertRaisesRegex(Exception, 'ERROR_PERMISSION_DENIED'):796 self.identity_v1.Authorization.verify(797 params,798 metadata=(('token', self.user_token),))799 def test_authorization_verify_project_role_access_system_api(self):800 self._test_create_user()801 self._test_create_project()802 self._test_create_project_role_binding(project_id=self.project.project_id)803 self._test_issue_user_token()804 params = {805 'service': 'identity',806 'resource': 'User',807 'verb': 'list',808 'scope': 'SYSTEM',809 'domain_id': utils.generate_id('domain')810 }811 # with self.assertRaisesRegex(Exception, 'ERROR_PERMISSION_DENIED'):812 # self.identity_v1.Authorization.verify(813 # params,814 # metadata=(('token', self.user_token),))815 def test_authorization_verify_project_role_access_domain_api(self):816 self._test_create_user()817 self._test_create_project()818 self._test_create_project_role_binding(project_id=self.project.project_id)819 self._test_issue_user_token()820 params = {821 'service': 'identity',822 'resource': 'User',823 'verb': 'list',824 'scope': 'DOMAIN',825 'domain_id': self.domain.domain_id826 }827 response = self.identity_v1.Authorization.verify(828 params,829 metadata=(('token', self.user_token),))830 self._print_data(response, 'test_authorization_verify_project_role_access_domain_api')831 self.assertEqual('PROJECT', response.role_type)832 def test_authorization_verify_project_role_list_users(self):833 self._test_create_user()834 self._test_create_project()835 self._test_create_project_role_binding(project_id=self.project.project_id)836 self._test_issue_user_token()837 params = {838 'user_id': self.user.user_id,839 'domain_id': self.domain.domain_id840 }841 response = self.identity_v1.User.list(842 params,843 metadata=(('token', self.user_token),))844 self._print_data(response, 'test_authorization_verify_project_role_get_user')845if __name__ == "__main__":...

Full Screen

Full Screen

User_Test.py

Source:User_Test.py Github

copy

Full Screen

2from database import db_session3from model import User4import random56def _test_create_user():7 _name = 'Test_User_%s' % random.randint(100001, 999999)8 _new_user = User(name=_name, email='%s@mantis.org' % _name)9 10 db_session.add(_new_user) # @UndefinedVariable11 db_session.commit() # @UndefinedVariable12 13def _test_edit_user():14 _user = db_session.query(User).get(random.randint(1, 20)) # @UndefinedVariable15 16 _new_name = 'Test_User_%s' % random.randint(100001, 999999)17 _id, _old_name, _user.name, _user.email = _user.id, _user.name, _new_name, '%s@mantis.org' % _new_name18 19 db_session.commit() # @UndefinedVariable20 print 'User [%s] renamed from [%s] to [%s]' % (_id, _old_name, _new_name)21 22if __name__ == '__main__':23 for i in range(20):24 _test_create_user()25 ...

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