Roman Prykhodchenko | 62b1ed1 | 2013-10-16 21:51:47 +0300 | [diff] [blame] | 1 | # vim: tabstop=4 shiftwidth=4 softtabstop=4 |
| 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 | |
| 15 | from tempest.api.baremetal import base |
| 16 | from tempest import test |
| 17 | |
| 18 | |
| 19 | class TestApiDiscovery(base.BaseBaremetalTest): |
| 20 | """Tests for API discovery features.""" |
| 21 | |
| 22 | @test.attr(type='smoke') |
| 23 | def test_api_versions(self): |
| 24 | resp, descr = self.client.get_api_description() |
| 25 | expected_versions = ('v1',) |
| 26 | |
| 27 | versions = [version['id'] for version in descr['versions']] |
| 28 | |
| 29 | for v in expected_versions: |
| 30 | self.assertIn(v, versions) |
| 31 | |
| 32 | @test.attr(type='smoke') |
| 33 | def test_default_version(self): |
| 34 | resp, descr = self.client.get_api_description() |
| 35 | default_version = descr['default_version'] |
| 36 | |
| 37 | self.assertEqual(default_version['id'], 'v1') |
| 38 | |
| 39 | @test.attr(type='smoke') |
| 40 | def test_version_1_resources(self): |
| 41 | resp, descr = self.client.get_version_description(version='v1') |
| 42 | expected_resources = ('nodes', 'chassis', |
| 43 | 'ports', 'links', 'media_types') |
| 44 | |
| 45 | for res in expected_resources: |
| 46 | self.assertIn(res, descr) |