Merge test_admin_actions 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 actions 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: I0b942e038ae6b50837e246f76c1e592539f1761a
This commit is contained in:
ghanshyam
2015-04-06 09:22:23 +09:00
parent f4504f3575
commit c54638e178
9 changed files with 18 additions and 58 deletions

View File

@@ -1,3 +0,0 @@
{
"injectNetworkInfo": null
}

View File

@@ -1,3 +0,0 @@
{
"resetNetwork": null
}

View File

@@ -1,5 +0,0 @@
{
"os-resetState": {
"state": "active"
}
}

View File

@@ -1,5 +0,0 @@
{
"os-resetState": {
"state": "active"
}
}

View File

@@ -1,5 +0,0 @@
{
'os-resetState': {
'state': 'active'
}
}

View File

@@ -799,37 +799,6 @@ class AvailabilityZoneJsonTest(ServersSampleBase):
response, 202)
class AdminActionsSamplesJsonTest(ServersSampleBase):
extension_name = ("nova.api.openstack.compute.contrib.admin_actions."
"Admin_actions")
def setUp(self):
"""setUp Method for AdminActions api samples extension
This method creates the server that will be used in each tests
"""
super(AdminActionsSamplesJsonTest, self).setUp()
self.uuid = self._post_server()
def test_post_reset_network(self):
# Get api samples to reset server network request.
response = self._do_post('servers/%s/action' % self.uuid,
'admin-actions-reset-network', {})
self.assertEqual(response.status_code, 202)
def test_post_inject_network_info(self):
# Get api samples to inject network info request.
response = self._do_post('servers/%s/action' % self.uuid,
'admin-actions-inject-network-info', {})
self.assertEqual(response.status_code, 202)
def test_post_reset_state(self):
# get api samples to server reset state request.
response = self._do_post('servers/%s/action' % self.uuid,
'admin-actions-reset-server-state', {})
self.assertEqual(response.status_code, 202)
class ConsoleAuthTokensSampleJsonTests(ServersSampleBase):
ADMIN_API = True
extends_name = ("nova.api.openstack.compute.contrib.consoles.Consoles")

View File

@@ -13,11 +13,29 @@
# 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 AdminActionsSamplesJsonTest(test_servers.ServersSampleBase):
extension_name = "os-admin-actions"
# 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 _get_flags(self):
f = super(AdminActionsSamplesJsonTest, self)._get_flags()
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
f['osapi_compute_extension'].append(
'nova.api.openstack.compute.contrib.admin_actions.Admin_actions')
return f
def setUp(self):
"""setUp Method for AdminActions api samples extension