How to use update_service_provider method in tempest

Best Python code snippet using tempest_python

test_service_provider.py

Source:test_service_provider.py Github

copy

Full Screen

...51 * whether the persona can list all identity providers52 """53 pass54 @abc.abstractmethod55 def test_identity_update_service_provider(self):56 """Test identity:update_service_provider policy.57 This test must check:58 * whether the persona can update a service provider59 * whether the persona can update a service provider that does not60 exist61 """62 pass63 @abc.abstractmethod64 def test_identity_delete_service_provider(self):65 """Test identity:delete_service_provider policy.66 This test must check67 * whether the persona can delete a service provider68 * whether the persona can delete a service provider that does not69 exist70 """71 pass72class SystemAdminTests(IdentityV3RbacServiceProviderTests,73 base.BaseIdentityTest):74 credentials = ['system_admin']75 def test_identity_create_service_provider(self):76 sp_id = self.do_request(77 'create_service_provider', expected_status=201,78 sp_id=data_utils.rand_name(),79 auth_url=data_utils.rand_url(),80 sp_url=data_utils.rand_url()81 )['service_provider']['id']82 self.addCleanup(self.admin_sp_client.delete_service_provider, sp_id)83 def test_identity_get_service_provider(self):84 sp_id = self.admin_sp_client.create_service_provider(85 sp_id=data_utils.rand_name(),86 auth_url=data_utils.rand_url(),87 sp_url=data_utils.rand_url())['service_provider']['id']88 self.addCleanup(self.admin_sp_client.delete_service_provider, sp_id)89 self.do_request('show_service_provider', sp_id=sp_id)90 # user gets a 404 for nonexistent sp91 self.do_request('show_service_provider',92 expected_status=exceptions.NotFound,93 sp_id=data_utils.rand_uuid_hex())94 def test_identity_list_service_providers(self):95 sp_id = self.admin_sp_client.create_service_provider(96 sp_id=data_utils.rand_name(),97 auth_url=data_utils.rand_url(),98 sp_url=data_utils.rand_url())['service_provider']['id']99 self.addCleanup(self.admin_sp_client.delete_service_provider, sp_id)100 resp = self.do_request('list_service_providers')101 self.assertIn(sp_id, [i['id'] for i in resp['service_providers']])102 def test_identity_update_service_provider(self):103 sp_id = self.admin_sp_client.create_service_provider(104 sp_id=data_utils.rand_name(),105 auth_url=data_utils.rand_url(),106 sp_url=data_utils.rand_url())['service_provider']['id']107 self.addCleanup(self.admin_sp_client.delete_service_provider, sp_id)108 self.do_request('update_service_provider',109 sp_id=sp_id,110 description=data_utils.arbitrary_string())111 # user gets a 404 for nonexistent sp112 self.do_request('update_service_provider',113 expected_status=exceptions.NotFound,114 sp_id=data_utils.rand_uuid_hex(),115 description=data_utils.arbitrary_string())116 def test_identity_delete_service_provider(self):117 sp_id = self.admin_sp_client.create_service_provider(118 sp_id=data_utils.rand_name(),119 auth_url=data_utils.rand_url(),120 sp_url=data_utils.rand_url())['service_provider']['id']121 self.do_request('delete_service_provider', expected_status=204,122 sp_id=sp_id)123 # user gets a 404 for nonexistent sp124 self.do_request('delete_service_provider',125 expected_status=exceptions.NotFound,126 sp_id=sp_id)127class SystemMemberTests(SystemAdminTests, base.BaseIdentityTest):128 credentials = ['system_member', 'system_admin']129 def test_identity_create_service_provider(self):130 self.do_request('create_service_provider',131 expected_status=exceptions.Forbidden,132 sp_id=data_utils.rand_name(),133 auth_url=data_utils.rand_url(),134 sp_url=data_utils.rand_url())135 def test_identity_update_service_provider(self):136 sp_id = self.admin_sp_client.create_service_provider(137 sp_id=data_utils.rand_name(),138 auth_url=data_utils.rand_url(),139 sp_url=data_utils.rand_url())['service_provider']['id']140 self.addCleanup(self.admin_sp_client.delete_service_provider, sp_id)141 self.do_request('update_service_provider',142 expected_status=exceptions.Forbidden,143 sp_id=sp_id,144 description=data_utils.arbitrary_string())145 # user gets a 403 for nonexistent sp146 self.do_request('update_service_provider',147 expected_status=exceptions.Forbidden,148 sp_id=data_utils.rand_uuid_hex(),149 description=data_utils.arbitrary_string())...

Full Screen

Full Screen

service_provider.py

Source:service_provider.py Github

copy

Full Screen

1# Licensed under the Apache License, Version 2.0 (the "License"); you may2# not use this file except in compliance with the License. You may obtain3# a copy of the License at4#5# http://www.apache.org/licenses/LICENSE-2.06#7# Unless required by applicable law or agreed to in writing, software8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the10# License for the specific language governing permissions and limitations11# under the License.12from oslo_log import versionutils13from oslo_policy import policy14from keystone.common.policies import base15DEPRECATED_REASON = (16 "The service provider API is now aware of system scope and default roles."17)18deprecated_get_sp = policy.DeprecatedRule(19 name=base.IDENTITY % 'get_service_provider',20 check_str=base.RULE_ADMIN_REQUIRED,21 deprecated_reason=DEPRECATED_REASON,22 deprecated_since=versionutils.deprecated.STEIN23)24deprecated_list_sp = policy.DeprecatedRule(25 name=base.IDENTITY % 'list_service_providers',26 check_str=base.RULE_ADMIN_REQUIRED,27 deprecated_reason=DEPRECATED_REASON,28 deprecated_since=versionutils.deprecated.STEIN29)30deprecated_update_sp = policy.DeprecatedRule(31 name=base.IDENTITY % 'update_service_provider',32 check_str=base.RULE_ADMIN_REQUIRED,33 deprecated_reason=DEPRECATED_REASON,34 deprecated_since=versionutils.deprecated.STEIN35)36deprecated_create_sp = policy.DeprecatedRule(37 name=base.IDENTITY % 'create_service_provider',38 check_str=base.RULE_ADMIN_REQUIRED,39 deprecated_reason=DEPRECATED_REASON,40 deprecated_since=versionutils.deprecated.STEIN41)42deprecated_delete_sp = policy.DeprecatedRule(43 name=base.IDENTITY % 'delete_service_provider',44 check_str=base.RULE_ADMIN_REQUIRED,45 deprecated_reason=DEPRECATED_REASON,46 deprecated_since=versionutils.deprecated.STEIN47)48service_provider_policies = [49 policy.DocumentedRuleDefault(50 name=base.IDENTITY % 'create_service_provider',51 check_str=base.SYSTEM_ADMIN,52 # FIXME(lbragstad): Today, keystone doesn't support federation without53 # modifying configuration files. It makes sense to require system scope54 # for these operations until keystone supports a way to add federated55 # identity and service providers strictly over the API. At that point,56 # it will make sense to include `project` in the list of `scope_types`57 # for service provider policies.58 scope_types=['system'],59 description='Create federated service provider.',60 operations=[{'path': ('/v3/OS-FEDERATION/service_providers/'61 '{service_provider_id}'),62 'method': 'PUT'}],63 deprecated_rule=deprecated_create_sp),64 policy.DocumentedRuleDefault(65 name=base.IDENTITY % 'list_service_providers',66 check_str=base.SYSTEM_READER,67 scope_types=['system'],68 description='List federated service providers.',69 operations=[70 {71 'path': '/v3/OS-FEDERATION/service_providers',72 'method': 'GET'73 },74 {75 'path': '/v3/OS-FEDERATION/service_providers',76 'method': 'HEAD'77 }78 ],79 deprecated_rule=deprecated_list_sp80 ),81 policy.DocumentedRuleDefault(82 name=base.IDENTITY % 'get_service_provider',83 check_str=base.SYSTEM_READER,84 scope_types=['system'],85 description='Get federated service provider.',86 operations=[87 {88 'path': ('/v3/OS-FEDERATION/service_providers/'89 '{service_provider_id}'),90 'method': 'GET'91 },92 {93 'path': ('/v3/OS-FEDERATION/service_providers/'94 '{service_provider_id}'),95 'method': 'HEAD'96 }97 ],98 deprecated_rule=deprecated_get_sp99 ),100 policy.DocumentedRuleDefault(101 name=base.IDENTITY % 'update_service_provider',102 check_str=base.SYSTEM_ADMIN,103 scope_types=['system'],104 description='Update federated service provider.',105 operations=[{'path': ('/v3/OS-FEDERATION/service_providers/'106 '{service_provider_id}'),107 'method': 'PATCH'}],108 deprecated_rule=deprecated_update_sp),109 policy.DocumentedRuleDefault(110 name=base.IDENTITY % 'delete_service_provider',111 check_str=base.SYSTEM_ADMIN,112 scope_types=['system'],113 description='Delete federated service provider.',114 operations=[{'path': ('/v3/OS-FEDERATION/service_providers/'115 '{service_provider_id}'),116 'method': 'DELETE'}],117 deprecated_rule=deprecated_delete_sp)118]119def list_rules():...

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