blob: bee10b9d9b603813e0670386318ef3d68786537a [file] [log] [blame]
Roman Prykhodchenko62b1ed12013-10-16 21:51:47 +03001# Licensed under the Apache License, Version 2.0 (the "License"); you may
2# not use this file except in compliance with the License. You may obtain
3# a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10# License for the specific language governing permissions and limitations
11# under the License.
12
13from tempest.api.baremetal import base
14from tempest import test
15
16
17class TestApiDiscovery(base.BaseBaremetalTest):
18 """Tests for API discovery features."""
19
20 @test.attr(type='smoke')
21 def test_api_versions(self):
22 resp, descr = self.client.get_api_description()
Mh Raiesa9bb79d2014-04-17 16:20:17 +053023 self.assertEqual('200', resp['status'])
Roman Prykhodchenko62b1ed12013-10-16 21:51:47 +030024 expected_versions = ('v1',)
25
26 versions = [version['id'] for version in descr['versions']]
27
28 for v in expected_versions:
29 self.assertIn(v, versions)
30
31 @test.attr(type='smoke')
32 def test_default_version(self):
33 resp, descr = self.client.get_api_description()
Mh Raiesa9bb79d2014-04-17 16:20:17 +053034 self.assertEqual('200', resp['status'])
Roman Prykhodchenko62b1ed12013-10-16 21:51:47 +030035 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')
Mh Raiesa9bb79d2014-04-17 16:20:17 +053042 self.assertEqual('200', resp['status'])
Roman Prykhodchenko62b1ed12013-10-16 21:51:47 +030043 expected_resources = ('nodes', 'chassis',
44 'ports', 'links', 'media_types')
45
46 for res in expected_resources:
47 self.assertIn(res, descr)