diff --git a/doc/api_samples/legacy_v2/versions/v2-version-get-resp.json b/doc/api_samples/versions/v2-version-get-resp.json similarity index 100% rename from doc/api_samples/legacy_v2/versions/v2-version-get-resp.json rename to doc/api_samples/versions/v2-version-get-resp.json diff --git a/doc/api_samples/versions/v21-version-get-resp.json b/doc/api_samples/versions/v21-version-get-resp.json new file mode 100644 index 000000000000..e3fb1bfa03a0 --- /dev/null +++ b/doc/api_samples/versions/v21-version-get-resp.json @@ -0,0 +1,26 @@ +{ + "version": { + "id": "v2.1", + "links": [ + { + "href": "http://openstack.example.com/v2.1/", + "rel": "self" + }, + { + "href": "http://docs.openstack.org/", + "rel": "describedby", + "type": "text/html" + } + ], + "media-types": [ + { + "base": "application/json", + "type": "application/vnd.openstack.compute+json;version=2.1" + } + ], + "status": "CURRENT", + "version": "2.11", + "min_version": "2.1", + "updated": "2013-07-23T11:33:21Z" + } +} diff --git a/doc/api_samples/legacy_v2/versions/versions-get-resp.json b/doc/api_samples/versions/versions-get-resp.json similarity index 100% rename from doc/api_samples/legacy_v2/versions/versions-get-resp.json rename to doc/api_samples/versions/versions-get-resp.json diff --git a/nova/tests/functional/api_sample_tests/legacy_v2/versions/v2-version-get-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/versions/v2-version-get-resp.json.tpl similarity index 100% rename from nova/tests/functional/api_sample_tests/legacy_v2/versions/v2-version-get-resp.json.tpl rename to nova/tests/functional/api_sample_tests/api_samples/versions/v2-version-get-resp.json.tpl diff --git a/nova/tests/functional/api_sample_tests/api_samples/versions/v21-version-get-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/versions/v21-version-get-resp.json.tpl new file mode 100644 index 000000000000..f81ed473f086 --- /dev/null +++ b/nova/tests/functional/api_sample_tests/api_samples/versions/v21-version-get-resp.json.tpl @@ -0,0 +1,26 @@ +{ + "version": { + "id": "v2.1", + "links": [ + { + "href": "http://openstack.example.com/v2.1/", + "rel": "self" + }, + { + "href": "http://docs.openstack.org/", + "rel": "describedby", + "type": "text/html" + } + ], + "media-types": [ + { + "base": "application/json", + "type": "application/vnd.openstack.compute+json;version=2.1" + } + ], + "status": "CURRENT", + "version": "2.11", + "min_version": "2.1", + "updated": "2013-07-23T11:33:21Z" + } +} \ No newline at end of file diff --git a/nova/tests/functional/api_sample_tests/legacy_v2/versions/versions-get-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/versions/versions-get-resp.json.tpl similarity index 100% rename from nova/tests/functional/api_sample_tests/legacy_v2/versions/versions-get-resp.json.tpl rename to nova/tests/functional/api_sample_tests/api_samples/versions/versions-get-resp.json.tpl diff --git a/nova/tests/functional/api_sample_tests/legacy_v2/test_api_samples.py b/nova/tests/functional/api_sample_tests/legacy_v2/test_api_samples.py index 8ba66d3af55d..4c7148137466 100644 --- a/nova/tests/functional/api_sample_tests/legacy_v2/test_api_samples.py +++ b/nova/tests/functional/api_sample_tests/legacy_v2/test_api_samples.py @@ -132,20 +132,6 @@ class ApiSamplesTrap(ApiSampleTestBaseV2): self.assertEqual(missing_tests, []) -class VersionsSampleJsonTest(ApiSampleTestBaseV2): - sample_dir = 'versions' - - def test_versions_get(self): - response = self._do_get('', strip_version=True) - subs = self._get_regexes() - self._verify_response('versions-get-resp', subs, response, 200) - - def test_versions_get_v2(self): - response = self._do_get('/v2', strip_version=True) - subs = self._get_regexes() - self._verify_response('v2-version-get-resp', subs, response, 200) - - class ServersSampleBase(ApiSampleTestBaseV2): def _post_server(self, use_common_server_api_samples=True): # param use_common_server_api_samples: Boolean to set whether tests use diff --git a/nova/tests/functional/api_sample_tests/test_versions.py b/nova/tests/functional/api_sample_tests/test_versions.py new file mode 100644 index 000000000000..bfc373bc3096 --- /dev/null +++ b/nova/tests/functional/api_sample_tests/test_versions.py @@ -0,0 +1,37 @@ +# Copyright 2012 Nebula, Inc. +# Copyright 2013 IBM Corp. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from nova.tests.functional.api_sample_tests import api_sample_base + + +class VersionsSampleJsonTest(api_sample_base.ApiSampleTestBaseV3): + sample_dir = 'versions' + scenarios = [('', {'_test': ''})] + _api_version = 'v2' + + def test_versions_get(self): + response = self._do_get('', strip_version=True) + subs = self._get_regexes() + self._verify_response('versions-get-resp', subs, response, 200) + + def test_versions_get_v2(self): + response = self._do_get('/v2', strip_version=True) + subs = self._get_regexes() + self._verify_response('v2-version-get-resp', subs, response, 200) + + def test_versions_get_v21(self): + response = self._do_get('/v2.1', strip_version=True) + subs = self._get_regexes() + self._verify_response('v21-version-get-resp', subs, response, 200)