Filip Hubík | 8135405 | 2015-03-09 19:04:23 +0100 | [diff] [blame] | 1 | # 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 | |
| 16 | from tempest.api.identity import base |
| 17 | from tempest import test |
| 18 | |
| 19 | |
| 20 | class 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 Ohmichi | 402b875 | 2015-11-09 10:47:16 +0000 | [diff] [blame^] | 26 | descr = self.non_admin_client.show_api_description()['version'] |
Filip Hubík | 8135405 | 2015-03-09 19:04:23 +0100 | [diff] [blame] | 27 | 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 Ohmichi | 402b875 | 2015-11-09 10:47:16 +0000 | [diff] [blame^] | 37 | descr = self.non_admin_client.show_api_description()['version'] |
Filip Hubík | 8135405 | 2015-03-09 19:04:23 +0100 | [diff] [blame] | 38 | # 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 Ohmichi | 402b875 | 2015-11-09 10:47:16 +0000 | [diff] [blame^] | 52 | descr = self.non_admin_client.show_api_description()['version'] |
Filip Hubík | 8135405 | 2015-03-09 19:04:23 +0100 | [diff] [blame] | 53 | status = descr['status'].lower() |
| 54 | supported_statuses = ['current', 'stable', 'experimental', |
| 55 | 'supported', 'deprecated'] |
| 56 | |
| 57 | self.assertIn(status, supported_statuses) |