summaryrefslogtreecommitdiff
path: root/keystone_tempest_plugin/tests/api/identity/v3/test_identity_providers.py
diff options
context:
space:
mode:
authorColleen Murphy <colleen@gazlene.net>2017-06-05 19:00:46 +0200
committerColleen Murphy <colleen@gazlene.net>2017-06-06 11:48:37 +0000
commit6f4e37e9e6810e24f45d034261f4a6ec4aa85fb1 (patch)
treee84be8b9f871425136995cbafccf9780ce8d95b6 /keystone_tempest_plugin/tests/api/identity/v3/test_identity_providers.py
parent5258c340d695bb344d386f94900992a1e982dfce (diff)
Remove the local tempest plugin
The plugin has been split into its own repository[1] in accordance with Queens Goal "Split Tempest Plugins into Separate Repos/Projects[2]". This patch removes the local copy as well as the setuptools entry point. We can also now remove the autodoc_tree_excludes pbr option since there's no more plugin to exclude and it defaults to [setup.py]. [1] http://git.openstack.org/cgit/openstack/keystone-tempest-plugin [2] https://governance.openstack.org/tc/goals/queens/split-tempest-plugins.html Depends-On: I47f59505126509b6b52cf04b8f7501e8ef4041b7 Change-Id: I1805b196b42b6a76c56e129a316e170e767455c1
Notes
Notes (review): Code-Review+1: Kristi Nikolla <knikolla@bu.edu> Code-Review+1: Gage Hugo <gagehugo@gmail.com> Code-Review+2: Morgan Fainberg <morgan.fainberg@gmail.com> Code-Review+2: Lance Bragstad <lbragstad@gmail.com> Workflow+1: Lance Bragstad <lbragstad@gmail.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Wed, 28 Jun 2017 15:56:23 +0000 Reviewed-on: https://review.openstack.org/471060 Project: openstack/keystone Branch: refs/heads/master
Diffstat (limited to 'keystone_tempest_plugin/tests/api/identity/v3/test_identity_providers.py')
-rw-r--r--keystone_tempest_plugin/tests/api/identity/v3/test_identity_providers.py244
1 files changed, 0 insertions, 244 deletions
diff --git a/keystone_tempest_plugin/tests/api/identity/v3/test_identity_providers.py b/keystone_tempest_plugin/tests/api/identity/v3/test_identity_providers.py
deleted file mode 100644
index 6b8f6a8..0000000
--- a/keystone_tempest_plugin/tests/api/identity/v3/test_identity_providers.py
+++ /dev/null
@@ -1,244 +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
15from tempest.lib.common.utils import data_utils
16from tempest.lib import decorators
17from tempest.lib import exceptions as lib_exc
18
19from keystone_tempest_plugin.tests.api.identity.v3 import fixtures
20from keystone_tempest_plugin.tests import base
21
22
23class IdentityProvidersTest(base.BaseIdentityTest):
24
25 def _assert_identity_provider_attributes(self, idp, idp_id, idp_ref=None):
26 self.assertIn('id', idp)
27 self.assertEqual(idp_id, idp['id'])
28
29 # Check the optional attributes have been set
30 self.assertIn('description', idp)
31 self.assertIn('enabled', idp)
32 self.assertIn('remote_ids', idp)
33
34 if idp_ref:
35 self.assertEqual(idp_ref['description'], idp['description'])
36
37 if 'enabled' in idp_ref:
38 self.assertEqual(idp_ref['enabled'], idp['enabled'])
39
40 if 'remote_ids' in idp_ref:
41 self.assertItemsEqual(idp_ref['remote_ids'], idp['remote_ids'])
42
43 def _create_idp(self, idp_id, idp_ref):
44 idp = self.idps_client.create_identity_provider(
45 idp_id, **idp_ref)['identity_provider']
46 self.addCleanup(
47 self.idps_client.delete_identity_provider, idp_id)
48 return idp
49
50 @decorators.idempotent_id('09450910-b816-4150-8513-a2fd4628a0c3')
51 def test_identity_provider_create(self):
52 idp_id = data_utils.rand_uuid_hex()
53 idp_ref = fixtures.idp_ref()
54 idp = self._create_idp(idp_id, idp_ref)
55
56 # The identity provider is disabled by default
57 idp_ref['enabled'] = False
58
59 # The remote_ids attribute should be set to an empty list by default
60 idp_ref['remote_ids'] = []
61
62 self._assert_identity_provider_attributes(idp, idp_id, idp_ref)
63
64 @decorators.idempotent_id('f430a337-545d-455e-bb6c-cb0fdf4be5c1')
65 def test_identity_provider_create_with_enabled_true(self):
66 idp_id = data_utils.rand_uuid_hex()
67 idp_ref = fixtures.idp_ref(enabled=True)
68 idp = self._create_idp(idp_id, idp_ref)
69
70 self._assert_identity_provider_attributes(idp, idp_id, idp_ref)
71
72 @decorators.idempotent_id('238e6163-d600-4f59-9982-c621f057221d')
73 def test_identity_provider_create_with_remote_ids(self):
74 idp_id = data_utils.rand_uuid_hex()
75 remote_ids = [data_utils.rand_uuid_hex(), data_utils.rand_uuid_hex()]
76 idp_ref = fixtures.idp_ref(remote_ids=remote_ids)
77 idp = self._create_idp(idp_id, idp_ref)
78
79 self._assert_identity_provider_attributes(idp, idp_id, idp_ref)
80
81 @decorators.idempotent_id('8a7817ad-27f8-436b-9cbe-46aa20989beb')
82 def test_identity_provider_get(self):
83 idp_id = data_utils.rand_uuid_hex()
84 idp_create = self._create_idp(idp_id, fixtures.idp_ref())
85
86 idp_get = self.idps_client.show_identity_provider(
87 idp_id)['identity_provider']
88 self._assert_identity_provider_attributes(idp_get, idp_id, idp_create)
89
90 @decorators.idempotent_id('cbfe5de9-c58a-4810-950c-2acdf985879d')
91 def test_identity_provider_list(self):
92 idp_ids = []
93 for _ in range(3):
94 idp_id = data_utils.rand_uuid_hex()
95 self._create_idp(idp_id, fixtures.idp_ref())
96 idp_ids.append(idp_id)
97
98 idp_list = self.idps_client.list_identity_providers()[
99 'identity_providers']
100 fetched_ids = [fetched_idp['id'] for fetched_idp in idp_list]
101
102 for idp_id in idp_ids:
103 self.assertIn(idp_id, fetched_ids)
104
105 @decorators.idempotent_id('36a0d9f0-9517-4139-85d0-f78d905aece5')
106 def test_identity_provider_update(self):
107 idp_id = data_utils.rand_uuid_hex()
108 idp = self._create_idp(idp_id, fixtures.idp_ref(enabled=True))
109
110 # The identity provider should be enabled
111 self.assertTrue(idp['enabled'])
112
113 idp = self.idps_client.update_identity_provider(
114 idp_id, enabled=False)['identity_provider']
115
116 # The identity provider should be disabled
117 self.assertFalse(idp['enabled'])
118
119 idp_get = self.idps_client.show_identity_provider(
120 idp_id)['identity_provider']
121 self.assertFalse(idp_get['enabled'])
122
123 def _assert_protocol_attributes(self, protocol, protocol_id,
124 mapping_id=None):
125 self.assertIn('id', protocol)
126 self.assertEqual(protocol_id, protocol['id'])
127
128 self.assertIn('mapping_id', protocol)
129 if mapping_id:
130 self.assertEqual(mapping_id, protocol['mapping_id'])
131
132 def _create_identity_provider_and_mapping(self):
133 # Create an identity provider
134 idp_id = data_utils.rand_uuid_hex()
135 self._create_idp(idp_id, fixtures.idp_ref(enabled=True))
136
137 # Create a mapping rule
138 mapping_id = data_utils.rand_uuid_hex()
139 self.mappings_client.create_mapping_rule(
140 mapping_id, fixtures.mapping_ref())
141 self.addCleanup(self.mappings_client.delete_mapping_rule, mapping_id)
142
143 return idp_id, mapping_id
144
145 def _create_protocol(self, idp_id, protocol_id, mapping_id):
146 protocol = self.idps_client.add_protocol_and_mapping(
147 idp_id, protocol_id, mapping_id)['protocol']
148 self.addCleanup(
149 self.idps_client.delete_protocol_and_mapping, idp_id, protocol_id)
150 return protocol
151
152 @decorators.idempotent_id('f5bdf482-1ad3-4aad-b52e-8fe7c1361104')
153 def test_add_protocol_to_identity_provider(self):
154 idp_id, mapping_id = self._create_identity_provider_and_mapping()
155
156 # Now we try to add a protocol to the identity provider
157 protocol_id = data_utils.rand_uuid_hex()
158 protocol = self._create_protocol(idp_id, protocol_id, mapping_id)
159
160 self._assert_protocol_attributes(protocol, protocol_id, mapping_id)
161
162 @decorators.idempotent_id('613d073b-0db7-41aa-b4df-5a1848cde0b3')
163 def test_get_protocol_from_identity_provider(self):
164 idp_id, mapping_id = self._create_identity_provider_and_mapping()
165
166 # Add a protocol to the identity provider
167 protocol_id = data_utils.rand_uuid_hex()
168 self._create_protocol(idp_id, protocol_id, mapping_id)
169
170 # Try to get the protocol
171 protocol = self.idps_client.get_protocol_and_mapping(
172 idp_id, protocol_id)['protocol']
173 self._assert_protocol_attributes(protocol, protocol_id, mapping_id)
174
175 @decorators.idempotent_id('6e6501ac-edae-4dc2-bb68-7a2b58602383')
176 def test_list_protocols_from_identity_provider(self):
177 idp_id, mapping_id = self._create_identity_provider_and_mapping()
178
179 protocol_ids = []
180 for _ in range(3):
181 protocol_id = data_utils.rand_uuid_hex()
182 self._create_protocol(idp_id, protocol_id, mapping_id)
183 protocol_ids.append(protocol_id)
184
185 protocols_list = self.idps_client.list_protocols_and_mappings(idp_id)[
186 'protocols']
187 fetched_ids = [fetched['id'] for fetched in protocols_list]
188
189 for protocol_id in protocol_ids:
190 self.assertIn(protocol_id, fetched_ids)
191
192 @decorators.idempotent_id('680d36df-d6b9-4695-be29-6fc2065c5dde')
193 def test_update_mapping_from_identity_provider_protocol(self):
194 idp_id, mapping_id = self._create_identity_provider_and_mapping()
195
196 # Add a protocol to the identity provider
197 protocol_id = data_utils.rand_uuid_hex()
198 protocol = self._create_protocol(idp_id, protocol_id, mapping_id)
199
200 # Create another mapping
201 new_mapping_id = data_utils.rand_uuid_hex()
202 self.mappings_client.create_mapping_rule(
203 new_mapping_id, fixtures.mapping_ref())
204
205 # Update the identity provider protocol
206 protocol = self.idps_client.update_protocol_mapping(
207 idp_id, protocol_id, new_mapping_id)['protocol']
208
209 self._assert_protocol_attributes(protocol, protocol_id, new_mapping_id)
210
211 @decorators.idempotent_id('04fdf262-af91-4a68-a1cf-794c6d2f2eeb')
212 def test_add_protocol_to_identity_provider_unknown_mapping(self):
213 # Create an identity provider
214 idp_id = data_utils.rand_uuid_hex()
215 self._create_idp(idp_id, fixtures.idp_ref(enabled=True))
216
217 # Now we try to add a protocol to the identity provider using
218 # a non existent mapping ID
219 mapping_id = data_utils.rand_uuid_hex()
220 protocol_id = data_utils.rand_uuid_hex()
221 self.assertRaises(
222 lib_exc.BadRequest,
223 self._create_protocol,
224 idp_id,
225 protocol_id,
226 mapping_id)
227
228 @decorators.idempotent_id('c73311e7-c207-4c11-998f-532a91f1b0d1')
229 def test_update_protocol_from_identity_provider_unknown_mapping(self):
230 idp_id, mapping_id = self._create_identity_provider_and_mapping()
231
232 # Add a protocol to the identity provider
233 protocol_id = data_utils.rand_uuid_hex()
234 self._create_protocol(idp_id, protocol_id, mapping_id)
235
236 # Update the identity provider protocol using a non existent
237 # mapping_id
238 new_mapping_id = data_utils.rand_uuid_hex()
239 self.assertRaises(
240 lib_exc.BadRequest,
241 self.idps_client.update_protocol_mapping,
242 idp_id,
243 protocol_id,
244 new_mapping_id)