blob: ebb96fd1bec418a6061ef7fe23eed887faad65e5 [file] [log] [blame]
Filip Hubík81354052015-03-09 19:04:23 +01001# Copyright 2015 OpenStack Foundation.
2# Copyright 2015, Red Hat, Inc.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16from tempest.api.identity import base
Saikiran692dcc12019-07-30 15:53:54 +053017from tempest import config
Ken'ichi Ohmichi44f01272017-01-27 18:44:14 -080018from tempest.lib import decorators
Filip Hubík81354052015-03-09 19:04:23 +010019
20
Saikiran692dcc12019-07-30 15:53:54 +053021CONF = config.CONF
22
23
Filip Hubík81354052015-03-09 19:04:23 +010024class TestApiDiscovery(base.BaseIdentityV3Test):
zhufl8e3aacd2020-04-27 14:46:46 +080025 """Tests for identity API discovery features."""
Filip Hubík81354052015-03-09 19:04:23 +010026
Saikiran692dcc12019-07-30 15:53:54 +053027 @decorators.idempotent_id('79aec9ae-710f-4c54-a4fc-3aa25b4feac3')
28 def test_identity_v3_existence(self):
zhufl8e3aacd2020-04-27 14:46:46 +080029 """Test that identity v3 version should exist"""
Saikiran692dcc12019-07-30 15:53:54 +053030 versions = self.non_admin_versions_client.list_versions()
31 found = any(
32 "v3" in version.get('id')
33 for version in versions['versions']['values'])
34 self.assertEqual(CONF.identity_feature_enabled.api_v3, found)
35
Ken'ichi Ohmichida26b162017-03-03 15:53:46 -080036 @decorators.idempotent_id('721f480f-35b6-46c7-846e-047e6acea0dc')
Jordan Pittier3b46d272017-04-12 16:17:28 +020037 @decorators.attr(type='smoke')
Ken'ichi Ohmichida26b162017-03-03 15:53:46 -080038 def test_list_api_versions(self):
zhufl8e3aacd2020-04-27 14:46:46 +080039 """Test listing identity api versions
40
41 NOTE: Actually this API doesn't depend on v3 API at all, because
42 the API operation is "GET /" without v3's endpoint. The reason of
43 this test path is just v3 API is CURRENT on Keystone side.
44 """
Ken'ichi Ohmichida26b162017-03-03 15:53:46 -080045 versions = self.non_admin_versions_client.list_versions()
46 expected_resources = ('id', 'links', 'media-types', 'status',
47 'updated')
48
49 for version in versions['versions']["values"]:
50 for res in expected_resources:
51 self.assertIn(res, version)
52
Jordan Pittier3b46d272017-04-12 16:17:28 +020053 @decorators.attr(type='smoke')
Ken'ichi Ohmichi44f01272017-01-27 18:44:14 -080054 @decorators.idempotent_id('b9232f5e-d9e5-4d97-b96c-28d3db4de1bd')
Filip Hubík81354052015-03-09 19:04:23 +010055 def test_api_version_resources(self):
zhufl8e3aacd2020-04-27 14:46:46 +080056 """Test showing identity v3 api version resources"""
Ken'ichi Ohmichi402b8752015-11-09 10:47:16 +000057 descr = self.non_admin_client.show_api_description()['version']
Filip Hubík81354052015-03-09 19:04:23 +010058 expected_resources = ('id', 'links', 'media-types', 'status',
59 'updated')
60
61 keys = descr.keys()
62 for res in expected_resources:
63 self.assertIn(res, keys)
64
Jordan Pittier3b46d272017-04-12 16:17:28 +020065 @decorators.attr(type='smoke')
Ken'ichi Ohmichi44f01272017-01-27 18:44:14 -080066 @decorators.idempotent_id('657c1970-4722-4189-8831-7325f3bc4265')
Filip Hubík81354052015-03-09 19:04:23 +010067 def test_api_media_types(self):
zhufl8e3aacd2020-04-27 14:46:46 +080068 """Test showing identity v3 api version media type"""
Ken'ichi Ohmichi402b8752015-11-09 10:47:16 +000069 descr = self.non_admin_client.show_api_description()['version']
Filip Hubík81354052015-03-09 19:04:23 +010070 # Get MIME type bases and descriptions
71 media_types = [(media_type['base'], media_type['type']) for
72 media_type in descr['media-types']]
73 # These are supported for API version 2
74 supported_types = [('application/json',
75 'application/vnd.openstack.identity-v3+json')]
76
77 # Check if supported types exist in response body
78 for s_type in supported_types:
79 self.assertIn(s_type, media_types)
80
Jordan Pittier3b46d272017-04-12 16:17:28 +020081 @decorators.attr(type='smoke')
Ken'ichi Ohmichi44f01272017-01-27 18:44:14 -080082 @decorators.idempotent_id('8879a470-abfb-47bb-bb8d-5a7fd279ad1e')
Filip Hubík81354052015-03-09 19:04:23 +010083 def test_api_version_statuses(self):
zhufl8e3aacd2020-04-27 14:46:46 +080084 """Test showing identity v3 api version status"""
Ken'ichi Ohmichi402b8752015-11-09 10:47:16 +000085 descr = self.non_admin_client.show_api_description()['version']
Filip Hubík81354052015-03-09 19:04:23 +010086 status = descr['status'].lower()
87 supported_statuses = ['current', 'stable', 'experimental',
88 'supported', 'deprecated']
89
90 self.assertIn(status, supported_statuses)