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
This commit is contained in:
ghanshyam 2015-04-06 10:14:15 +09:00
parent b6e5d68c66
commit 90312d9480
4 changed files with 11 additions and 33 deletions

View File

@ -1,5 +0,0 @@
{
"changePassword" : {
"adminPass" : "foo"
}
}

View File

@ -1,5 +0,0 @@
{
"changePassword" : {
"adminPass" : "%(password)s"
}
}

View File

@ -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"

View File

@ -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()