summaryrefslogtreecommitdiff
path: root/keystone_tempest_plugin/services/identity/clients.py
diff options
context:
space:
mode:
Diffstat (limited to 'keystone_tempest_plugin/services/identity/clients.py')
-rw-r--r--keystone_tempest_plugin/services/identity/clients.py78
1 files changed, 0 insertions, 78 deletions
diff --git a/keystone_tempest_plugin/services/identity/clients.py b/keystone_tempest_plugin/services/identity/clients.py
deleted file mode 100644
index aac45d3..0000000
--- a/keystone_tempest_plugin/services/identity/clients.py
+++ /dev/null
@@ -1,78 +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
17import six
18from six.moves import http_client
19from tempest import config
20from tempest.lib.common import rest_client
21
22
23CONF = config.CONF
24
25# We only use the identity catalog type
26SERVICE_TYPE = 'identity'
27
28
29class Identity(rest_client.RestClient):
30 """Tempest REST client for keystone."""
31
32 # Used by the superclass to build the correct URL paths
33 api_version = 'v3'
34
35 def __init__(self, auth_provider):
36 super(Identity, self).__init__(
37 auth_provider,
38 SERVICE_TYPE,
39 CONF.identity.region,
40 endpoint_type='adminURL')
41
42
43class Federation(Identity):
44 """Tempest REST client for keystone's Federated Identity API."""
45
46 subpath_prefix = 'OS-FEDERATION'
47 subpath_suffix = None
48
49 def _build_path(self, entity_id=None):
50 subpath = '%s/%s' % (self.subpath_prefix, self.subpath_suffix)
51 return '%s/%s' % (subpath, entity_id) if entity_id else subpath
52
53 def _delete(self, entity_id, **kwargs):
54 url = self._build_path(entity_id)
55 resp, body = super(Federation, self).delete(url, **kwargs)
56 self.expected_success(http_client.NO_CONTENT, resp.status)
57 return rest_client.ResponseBody(resp, body)
58
59 def _get(self, entity_id=None, **kwargs):
60 url = self._build_path(entity_id)
61 resp, body = super(Federation, self).get(url, **kwargs)
62 self.expected_success(http_client.OK, resp.status)
63 body = json.loads(body if six.PY2 else body.decode('utf-8'))
64 return rest_client.ResponseBody(resp, body)
65
66 def _patch(self, entity_id, body, **kwargs):
67 url = self._build_path(entity_id)
68 resp, body = super(Federation, self).patch(url, body, **kwargs)
69 self.expected_success(http_client.OK, resp.status)
70 body = json.loads(body if six.PY2 else body.decode('utf-8'))
71 return rest_client.ResponseBody(resp, body)
72
73 def _put(self, entity_id, body, **kwargs):
74 url = self._build_path(entity_id)
75 resp, body = super(Federation, self).put(url, body, **kwargs)
76 self.expected_success(http_client.CREATED, resp.status)
77 body = json.loads(body if six.PY2 else body.decode('utf-8'))
78 return rest_client.ResponseBody(resp, body)