How to use add_endpoint_to_project method in tempest

Best Python code snippet using tempest_python

test_project_endpoint.py

Source:test_project_endpoint.py Github

copy

Full Screen

...45 cls.addClassResourceCleanup(46 cls.admin_client.endpoints_v3_client.delete_endpoint,47 endpoint_id=cls.endpoint_id)48 @abc.abstractmethod49 def test_identity_add_endpoint_to_project(self):50 """Test identity:add_endpoint_to_project policy.51 This test must check:52 * whether the persona can allow a project to access an endpoint53 """54 pass55 @abc.abstractmethod56 def test_identity_check_endpoint_in_project(self):57 """Test identity:check_endpoint_in_project policy.58 This test must check:59 * whether the persona can check if a project has access to an60 endpoint61 """62 pass63 @abc.abstractmethod64 def test_identity_list_projects_for_endpoint(self):65 """Test identity:list_projects_for_endpoint policy.66 This test must check:67 * whether the persona can list all projects that have access to an68 endpoint69 """70 pass71 @abc.abstractmethod72 def test_identity_list_endpoints_for_project(self):73 """Test identity:list_endpoints_for_project policy.74 This test must check:75 * whether the persona can list all endpoints to which a project has76 access77 """78 pass79 @abc.abstractmethod80 def test_identity_remove_endpoint_from_project(self):81 """Test identity:remove_endpoint_from_project policy.82 This test must check83 * whether the persona can remove a project's access to an endpoint84 """85 pass86class SystemAdminTests(IdentityV3RbacProjectEndpointsTests):87 credentials = ['system_admin']88 def test_identity_add_endpoint_to_project(self):89 self.do_request('add_endpoint_to_project',90 expected_status=204,91 project_id=self.project_id,92 endpoint_id=self.endpoint_id)93 self.addCleanup(self.admin_ef_client.delete_endpoint_from_project,94 project_id=self.project_id,95 endpoint_id=self.endpoint_id)96 def test_identity_check_endpoint_in_project(self):97 self.admin_ef_client.add_endpoint_to_project(98 project_id=self.project_id,99 endpoint_id=self.endpoint_id)100 self.addCleanup(self.admin_ef_client.delete_endpoint_from_project,101 project_id=self.project_id,102 endpoint_id=self.endpoint_id)103 self.do_request('check_endpoint_in_project',104 expected_status=204,105 project_id=self.project_id,106 endpoint_id=self.endpoint_id)107 def test_identity_list_projects_for_endpoint(self):108 self.admin_ef_client.add_endpoint_to_project(109 project_id=self.project_id,110 endpoint_id=self.endpoint_id)111 self.addCleanup(self.admin_ef_client.delete_endpoint_from_project,112 project_id=self.project_id,113 endpoint_id=self.endpoint_id)114 resp = self.do_request('list_projects_for_endpoint',115 endpoint_id=self.endpoint_id)116 self.assertIn(self.project_id, [p['id'] for p in resp['projects']])117 def test_identity_list_endpoints_for_project(self):118 self.admin_ef_client.add_endpoint_to_project(119 project_id=self.project_id,120 endpoint_id=self.endpoint_id)121 self.addCleanup(self.admin_ef_client.delete_endpoint_from_project,122 project_id=self.project_id,123 endpoint_id=self.endpoint_id)124 resp = self.do_request('list_endpoints_in_project',125 project_id=self.project_id)126 self.assertIn(self.endpoint_id, [e['id'] for e in resp['endpoints']])127 def test_identity_remove_endpoint_from_project(self):128 self.admin_ef_client.add_endpoint_to_project(129 project_id=self.project_id,130 endpoint_id=self.endpoint_id)131 self.do_request('delete_endpoint_from_project',132 expected_status=204,133 project_id=self.project_id,134 endpoint_id=self.endpoint_id)135class SystemMemberTests(SystemAdminTests):136 credentials = ['system_member', 'system_admin']137 def test_identity_add_endpoint_to_project(self):138 self.do_request('add_endpoint_to_project',139 expected_status=exceptions.Forbidden,140 project_id=self.project_id,141 endpoint_id=self.endpoint_id)142 def test_identity_remove_endpoint_from_project(self):143 self.admin_ef_client.add_endpoint_to_project(144 project_id=self.project_id,145 endpoint_id=self.endpoint_id)146 self.addCleanup(self.admin_ef_client.delete_endpoint_from_project,147 project_id=self.project_id,148 endpoint_id=self.endpoint_id)149 self.do_request('delete_endpoint_from_project',150 expected_status=exceptions.Forbidden,151 project_id=self.project_id,152 endpoint_id=self.endpoint_id)153class SystemReaderTests(SystemMemberTests):154 credentials = ['system_reader', 'system_admin']155class DomainAdminTests(SystemReaderTests, base.BaseIdentityTest):156 credentials = ['domain_admin', 'system_admin']157 def test_identity_check_endpoint_in_project(self):158 self.admin_ef_client.add_endpoint_to_project(159 project_id=self.project_id,160 endpoint_id=self.endpoint_id)161 self.addCleanup(self.admin_ef_client.delete_endpoint_from_project,162 project_id=self.project_id,163 endpoint_id=self.endpoint_id)164 self.do_request('check_endpoint_in_project',165 expected_status=exceptions.Forbidden,166 project_id=self.project_id,167 endpoint_id=self.endpoint_id)168 def test_identity_list_projects_for_endpoint(self):169 self.admin_ef_client.add_endpoint_to_project(170 project_id=self.project_id,171 endpoint_id=self.endpoint_id)172 self.addCleanup(self.admin_ef_client.delete_endpoint_from_project,173 project_id=self.project_id,174 endpoint_id=self.endpoint_id)175 self.do_request('list_projects_for_endpoint',176 expected_status=exceptions.Forbidden,177 endpoint_id=self.endpoint_id)178 def test_identity_list_endpoints_for_project(self):179 self.admin_ef_client.add_endpoint_to_project(180 project_id=self.project_id,181 endpoint_id=self.endpoint_id)182 self.addCleanup(self.admin_ef_client.delete_endpoint_from_project,183 project_id=self.project_id,184 endpoint_id=self.endpoint_id)185 self.do_request('list_endpoints_in_project',186 expected_status=exceptions.Forbidden,187 project_id=self.project_id)188class DomainMemberTests(DomainAdminTests, base.BaseIdentityTest):189 credentials = ['domain_member', 'system_admin']190class DomainReaderTests(DomainMemberTests):191 credentials = ['domain_reader', 'system_admin']192class ProjectAdminTests(DomainReaderTests, base.BaseIdentityTest):193 credentials = ['project_admin', 'system_admin']...

Full Screen

Full Screen

test_endpoint_filter_rbac.py

Source:test_endpoint_filter_rbac.py Github

copy

Full Screen

...27 super(IdentityEndpointsFilterV3RbacTest, cls).resource_setup()28 cls.project = cls.setup_test_project()29 cls.service = cls.setup_test_service()30 cls.endpoint = cls.setup_test_endpoint(service=cls.service)31 def _add_endpoint_to_project(self):32 # Adding and cleaning up endpoints to projects33 self.ep_api_client.add_endpoint_to_project(34 self.project['id'], self.endpoint['id'])35 self.addCleanup(test_utils.call_and_ignore_notfound_exc,36 self.ep_api_client.delete_endpoint_from_project,37 self.project['id'], self.endpoint['id'])38 @rbac_rule_validation.action(39 service="keystone",40 rule="identity:add_endpoint_to_project")41 @decorators.idempotent_id('9199ec13-816d-4efe-b8b1-e1cd026b9747')42 def test_add_endpoint_to_project(self):43 # Adding endpoints to projects44 self.rbac_utils.switch_role(self, toggle_rbac_role=True)45 self._add_endpoint_to_project()46 @rbac_rule_validation.action(47 service="keystone",48 rule="identity:list_projects_for_endpoint")49 @decorators.idempotent_id('f53dca42-ec8a-48e9-924b-0bbe6c99727f')50 def test_list_projects_for_endpoint(self):51 self.rbac_utils.switch_role(self, toggle_rbac_role=True)52 self.ep_api_client.list_projects_for_endpoint(53 self.endpoint['id'])54 @rbac_rule_validation.action(55 service="keystone",56 rule="identity:check_endpoint_in_project")57 @decorators.idempotent_id('0c1425eb-833c-4aa1-a21d-52ffa41fdc6a')58 def test_check_endpoint_in_project(self):59 self._add_endpoint_to_project()60 self.rbac_utils.switch_role(self, toggle_rbac_role=True)61 self.ep_api_client.check_endpoint_in_project(62 self.project['id'], self.endpoint['id'])63 @rbac_rule_validation.action(64 service="keystone",65 rule="identity:list_endpoints_for_project")66 @decorators.idempotent_id('5d86c659-c6ad-41e0-854e-3823e95c7cc2')67 def test_list_endpoints_in_project(self):68 self.rbac_utils.switch_role(self, toggle_rbac_role=True)69 self.ep_api_client.list_endpoints_in_project(70 self.project['id'])71 @rbac_rule_validation.action(72 service="keystone",73 rule="identity:remove_endpoint_from_project")74 @decorators.idempotent_id('b4e21c10-4f47-427b-9b8a-f5b5601adfda')75 def test_remove_endpoint_from_project(self):76 self._add_endpoint_to_project()77 self.rbac_utils.switch_role(self, toggle_rbac_role=True)78 self.ep_api_client.delete_endpoint_from_project(...

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