From 90312d9480e6276774d617752a4689e45e37a95b Mon Sep 17 00:00:00 2001 From: ghanshyam Date: Mon, 6 Apr 2015 10:14:15 +0900 Subject: [PATCH] Share admin password func test between v2 and v2.1 Currently v2 and v2.1 have separate functional tests and their corresponding sample files. As v2 and v2.1 are supposed to be identical, there is overhead to maintain two set of functional tests and sample files. We can have one set of tests which can run for both v2 and v2.1. This commit merges admin password functional tests. In V2.1 os-access-ip is separate plugin where in v2 it was mixed in server plugin itself. So os-access-ip extension is enabled for v2.1 tests to run successfully. Change-Id: Icfb9253ffb0852d15e685045a31b9fe811722733 --- .../servers/server-action-changepassword.json | 5 ---- .../server-action-changepassword.json.tpl | 5 ---- nova/tests/functional/test_api_samples.py | 23 ------------------- .../functional/v3/test_admin_password.py | 11 +++++++++ 4 files changed, 11 insertions(+), 33 deletions(-) delete mode 100644 doc/api_samples/servers/server-action-changepassword.json delete mode 100644 nova/tests/functional/api_samples/servers/server-action-changepassword.json.tpl diff --git a/doc/api_samples/servers/server-action-changepassword.json b/doc/api_samples/servers/server-action-changepassword.json deleted file mode 100644 index 421a4aa939a9..000000000000 --- a/doc/api_samples/servers/server-action-changepassword.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "changePassword" : { - "adminPass" : "foo" - } -} \ No newline at end of file diff --git a/nova/tests/functional/api_samples/servers/server-action-changepassword.json.tpl b/nova/tests/functional/api_samples/servers/server-action-changepassword.json.tpl deleted file mode 100644 index da615718fe20..000000000000 --- a/nova/tests/functional/api_samples/servers/server-action-changepassword.json.tpl +++ /dev/null @@ -1,5 +0,0 @@ -{ - "changePassword" : { - "adminPass" : "%(password)s" - } -} diff --git a/nova/tests/functional/test_api_samples.py b/nova/tests/functional/test_api_samples.py index fca0859cad3c..096dbc3bf03d 100644 --- a/nova/tests/functional/test_api_samples.py +++ b/nova/tests/functional/test_api_samples.py @@ -233,29 +233,6 @@ class LimitsSampleJsonTest(ApiSampleTestBaseV2): self._verify_response('limit-get-resp', subs, response, 200) -class ServersActionsJsonTest(ServersSampleBase): - sample_dir = 'servers' - - def _test_server_action(self, uuid, action, - subs=None, resp_tpl=None, code=202): - subs = subs or {} - subs.update({'action': action}) - response = self._do_post('servers/%s/action' % uuid, - 'server-action-%s' % action.lower(), - subs) - if resp_tpl: - subs.update(self._get_regexes()) - self._verify_response(resp_tpl, subs, response, code) - else: - self.assertEqual(response.status_code, code) - self.assertEqual(response.content, "") - - def test_server_password(self): - uuid = self._post_server() - self._test_server_action(uuid, "changePassword", - {"password": "foo"}) - - class SecurityGroupsSampleJsonTest(ServersSampleBase): extension_name = "nova.api.openstack.compute.contrib" + \ ".security_groups.Security_groups" diff --git a/nova/tests/functional/v3/test_admin_password.py b/nova/tests/functional/v3/test_admin_password.py index 2d2c85cdce57..fbf3f874798a 100644 --- a/nova/tests/functional/v3/test_admin_password.py +++ b/nova/tests/functional/v3/test_admin_password.py @@ -13,11 +13,22 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_config import cfg + from nova.tests.functional.v3 import test_servers +CONF = cfg.CONF +CONF.import_opt('osapi_compute_extension', + 'nova.api.openstack.compute.extensions') + class AdminPasswordJsonTest(test_servers.ServersSampleBase): extension_name = 'os-admin-password' + # TODO(gmann): Overriding '_api_version' till all functional tests + # are merged between v2 and v2.1. After that base class variable + # itself can be changed to 'v2' + _api_version = 'v2' + extra_extensions_to_load = ["os-access-ips"] def test_server_password(self): uuid = self._post_server()