blob: 74e9ec1de67f91b9768a577165da2b5526e2f5a6 [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
17from tempest import test
18
19
20class TestApiDiscovery(base.BaseIdentityV3Test):
21 """Tests for API discovery features."""
22
23 @test.attr(type='smoke')
24 @test.idempotent_id('b9232f5e-d9e5-4d97-b96c-28d3db4de1bd')
25 def test_api_version_resources(self):
Ken'ichi Ohmichi402b8752015-11-09 10:47:16 +000026 descr = self.non_admin_client.show_api_description()['version']
Filip Hubík81354052015-03-09 19:04:23 +010027 expected_resources = ('id', 'links', 'media-types', 'status',
28 'updated')
29
30 keys = descr.keys()
31 for res in expected_resources:
32 self.assertIn(res, keys)
33
34 @test.attr(type='smoke')
35 @test.idempotent_id('657c1970-4722-4189-8831-7325f3bc4265')
36 def test_api_media_types(self):
Ken'ichi Ohmichi402b8752015-11-09 10:47:16 +000037 descr = self.non_admin_client.show_api_description()['version']
Filip Hubík81354052015-03-09 19:04:23 +010038 # Get MIME type bases and descriptions
39 media_types = [(media_type['base'], media_type['type']) for
40 media_type in descr['media-types']]
41 # These are supported for API version 2
42 supported_types = [('application/json',
43 'application/vnd.openstack.identity-v3+json')]
44
45 # Check if supported types exist in response body
46 for s_type in supported_types:
47 self.assertIn(s_type, media_types)
48
49 @test.attr(type='smoke')
50 @test.idempotent_id('8879a470-abfb-47bb-bb8d-5a7fd279ad1e')
51 def test_api_version_statuses(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 status = descr['status'].lower()
54 supported_statuses = ['current', 'stable', 'experimental',
55 'supported', 'deprecated']
56
57 self.assertIn(status, supported_statuses)