summaryrefslogtreecommitdiff
path: root/keystone_tempest_plugin/services/identity/v3/service_providers_client.py
diff options
context:
space:
mode:
Diffstat (limited to 'keystone_tempest_plugin/services/identity/v3/service_providers_client.py')
-rw-r--r--keystone_tempest_plugin/services/identity/v3/service_providers_client.py73
1 files changed, 0 insertions, 73 deletions
diff --git a/keystone_tempest_plugin/services/identity/v3/service_providers_client.py b/keystone_tempest_plugin/services/identity/v3/service_providers_client.py
deleted file mode 100644
index 093ce0f..0000000
--- a/keystone_tempest_plugin/services/identity/v3/service_providers_client.py
+++ /dev/null
@@ -1,73 +0,0 @@
1# Copyright 2016 Red Hat, Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15import json
16
17from keystone_tempest_plugin.services.identity import clients
18
19
20class ServiceProvidersClient(clients.Federation):
21
22 subpath_suffix = 'service_providers'
23
24 def create_service_provider(self, sp_id, **kwargs):
25 """Create a service provider.
26
27 :param str sp_id: The ID to be used to create the Service Provider.
28 :param kwargs: Extra attributes. Mandatory: auth_url (str) and sp_url
29 (str). Optional: description (str), enabled (boolean)
30 and relay_state_prefix (str).
31 """
32 put_body = json.dumps({'service_provider': kwargs})
33 return self._put(sp_id, put_body)
34
35 def list_service_providers(self):
36 """List the service providers."""
37 return self._get()
38
39 def show_service_provider(self, sp_id):
40 """Get a service provider."""
41 return self._get(sp_id)
42
43 def delete_service_provider(self, sp_id):
44 """Delete a service provider."""
45 return self._delete(sp_id)
46
47 def update_service_provider(self, sp_id, **kwargs):
48 """Update a service provider.
49
50 :param str sp_id: The ID of the Service Provider to be updated.
51 :param kwargs: All attributes to be updated: auth_url (str) and sp_url
52 (str), description (str), enabled (boolean) and
53 relay_state_prefix (str).
54 """
55 patch_body = json.dumps({'service_provider': kwargs})
56 return self._patch(sp_id, patch_body)
57
58 def get_service_providers_in_token(self):
59 """Get the service providers list present in the token.
60
61 Only enabled service providers are displayed in the token.
62 """
63 # First we force the auth_data update via the set_auth() command
64 # in the auth_provider
65 self.auth_provider.set_auth()
66
67 # Now we can retrieve the updated auth_data
68 auth_data = self.auth_provider.get_auth()[1]
69 try:
70 return auth_data['service_providers']
71 except KeyError:
72 # no service providers in token
73 return []