blob: 177a49dd93f8fd824e8e433bd800bc272d42d418 [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
Ken'ichi Ohmichi44f01272017-01-27 18:44:14 -080017from tempest.lib import decorators
Filip Hubík81354052015-03-09 19:04:23 +010018from tempest import test
19
20
21class TestApiDiscovery(base.BaseIdentityV3Test):
22 """Tests for API discovery features."""
23
Ken'ichi Ohmichida26b162017-03-03 15:53:46 -080024 @decorators.idempotent_id('721f480f-35b6-46c7-846e-047e6acea0dc')
25 @test.attr(type='smoke')
26 def test_list_api_versions(self):
27 # NOTE: Actually this API doesn't depend on v3 API at all, because
28 # the API operation is "GET /" without v3's endpoint. The reason of
29 # this test path is just v3 API is CURRENT on Keystone side.
30 versions = self.non_admin_versions_client.list_versions()
31 expected_resources = ('id', 'links', 'media-types', 'status',
32 'updated')
33
34 for version in versions['versions']["values"]:
35 for res in expected_resources:
36 self.assertIn(res, version)
37
Filip Hubík81354052015-03-09 19:04:23 +010038 @test.attr(type='smoke')
Ken'ichi Ohmichi44f01272017-01-27 18:44:14 -080039 @decorators.idempotent_id('b9232f5e-d9e5-4d97-b96c-28d3db4de1bd')
Filip Hubík81354052015-03-09 19:04:23 +010040 def test_api_version_resources(self):
Ken'ichi Ohmichi402b8752015-11-09 10:47:16 +000041 descr = self.non_admin_client.show_api_description()['version']
Filip Hubík81354052015-03-09 19:04:23 +010042 expected_resources = ('id', 'links', 'media-types', 'status',
43 'updated')
44
45 keys = descr.keys()
46 for res in expected_resources:
47 self.assertIn(res, keys)
48
49 @test.attr(type='smoke')
Ken'ichi Ohmichi44f01272017-01-27 18:44:14 -080050 @decorators.idempotent_id('657c1970-4722-4189-8831-7325f3bc4265')
Filip Hubík81354052015-03-09 19:04:23 +010051 def test_api_media_types(self):
Ken'ichi Ohmichi402b8752015-11-09 10:47:16 +000052 descr = self.non_admin_client.show_api_description()['version']
Filip Hubík81354052015-03-09 19:04:23 +010053 # Get MIME type bases and descriptions
54 media_types = [(media_type['base'], media_type['type']) for
55 media_type in descr['media-types']]
56 # These are supported for API version 2
57 supported_types = [('application/json',
58 'application/vnd.openstack.identity-v3+json')]
59
60 # Check if supported types exist in response body
61 for s_type in supported_types:
62 self.assertIn(s_type, media_types)
63
64 @test.attr(type='smoke')
Ken'ichi Ohmichi44f01272017-01-27 18:44:14 -080065 @decorators.idempotent_id('8879a470-abfb-47bb-bb8d-5a7fd279ad1e')
Filip Hubík81354052015-03-09 19:04:23 +010066 def test_api_version_statuses(self):
Ken'ichi Ohmichi402b8752015-11-09 10:47:16 +000067 descr = self.non_admin_client.show_api_description()['version']
Filip Hubík81354052015-03-09 19:04:23 +010068 status = descr['status'].lower()
69 supported_statuses = ['current', 'stable', 'experimental',
70 'supported', 'deprecated']
71
72 self.assertIn(status, supported_statuses)