Merge "Rename instance_actions v3 plugin tests to server_actions"

This commit is contained in:
Jenkins 2014-04-16 05:15:10 +00:00 committed by Gerrit Code Review
commit dc5c270d10
3 changed files with 18 additions and 16 deletions

View File

@ -27,25 +27,27 @@ class InstanceActionsV3Test(base.BaseV3ComputeTest):
cls.resp = resp cls.resp = resp
cls.server_id = server['id'] cls.server_id = server['id']
@test.skip_because(bug="1206032")
@test.attr(type='gate') @test.attr(type='gate')
def test_list_instance_actions(self): def test_list_server_actions(self):
# List actions of the provided server # List actions of the provided server
resp, body = self.client.reboot(self.server_id, 'HARD') resp, body = self.client.reboot(self.server_id, 'HARD')
self.client.wait_for_server_status(self.server_id, 'ACTIVE') self.client.wait_for_server_status(self.server_id, 'ACTIVE')
resp, body = self.client.list_instance_actions(self.server_id) resp, body = self.client.list_server_actions(self.server_id)
self.assertEqual(200, resp.status) self.assertEqual(200, resp.status)
self.assertTrue(len(body) == 2, str(body)) self.assertTrue(len(body) == 2, str(body))
self.assertTrue(any([i for i in body if i['action'] == 'create'])) self.assertTrue(any([i for i in body if i['action'] == 'create']))
self.assertTrue(any([i for i in body if i['action'] == 'reboot'])) self.assertTrue(any([i for i in body if i['action'] == 'reboot']))
@test.skip_because(bug="1206032")
@test.attr(type='gate') @test.attr(type='gate')
@test.skip_because(bug="1281915") @test.skip_because(bug="1281915")
def test_get_instance_action(self): def test_get_server_action(self):
# Get the action details of the provided server # Get the action details of the provided server
request_id = self.resp['x-compute-request-id'] request_id = self.resp['x-compute-request-id']
resp, body = self.client.get_instance_action(self.server_id, resp, body = self.client.get_server_action(self.server_id,
request_id) request_id)
self.assertEqual(200, resp.status) self.assertEqual(200, resp.status)
self.assertEqual(self.server_id, body['instance_uuid']) self.assertEqual(self.server_id, body['server_uuid'])
self.assertEqual('create', body['action']) self.assertEqual('create', body['action'])

View File

@ -29,15 +29,15 @@ class InstanceActionsNegativeV3Test(base.BaseV3ComputeTest):
cls.server_id = server['id'] cls.server_id = server['id']
@test.attr(type=['negative', 'gate']) @test.attr(type=['negative', 'gate'])
def test_list_instance_actions_invalid_server(self): def test_list_server_actions_invalid_server(self):
# List actions of the invalid server id # List actions of the invalid server id
invalid_server_id = data_utils.rand_uuid() invalid_server_id = data_utils.rand_uuid()
self.assertRaises(exceptions.NotFound, self.assertRaises(exceptions.NotFound,
self.client.list_instance_actions, invalid_server_id) self.client.list_server_actions, invalid_server_id)
@test.attr(type=['negative', 'gate']) @test.attr(type=['negative', 'gate'])
def test_get_instance_action_invalid_request(self): def test_get_server_action_invalid_request(self):
# Get the action details of the provided server with invalid request # Get the action details of the provided server with invalid request
invalid_request_id = 'req-' + data_utils.rand_uuid() invalid_request_id = 'req-' + data_utils.rand_uuid()
self.assertRaises(exceptions.NotFound, self.client.get_instance_action, self.assertRaises(exceptions.NotFound, self.client.get_server_action,
self.server_id, invalid_request_id) self.server_id, invalid_request_id)

View File

@ -410,19 +410,19 @@ class ServersV3ClientJSON(rest_client.RestClient):
str(server_id)) str(server_id))
return resp, json.loads(body) return resp, json.loads(body)
def list_instance_actions(self, server_id): def list_server_actions(self, server_id):
"""List the provided server action.""" """List the provided server action."""
resp, body = self.get("servers/%s/os-instance-actions" % resp, body = self.get("servers/%s/os-server-actions" %
str(server_id)) str(server_id))
body = json.loads(body) body = json.loads(body)
return resp, body['instance_actions'] return resp, body['server_actions']
def get_instance_action(self, server_id, request_id): def get_server_action(self, server_id, request_id):
"""Returns the action details of the provided server.""" """Returns the action details of the provided server."""
resp, body = self.get("servers/%s/os-instance-actions/%s" % resp, body = self.get("servers/%s/os-server-actions/%s" %
(str(server_id), str(request_id))) (str(server_id), str(request_id)))
body = json.loads(body) body = json.loads(body)
return resp, body['instance_action'] return resp, body['server_action']
def force_delete_server(self, server_id, **kwargs): def force_delete_server(self, server_id, **kwargs):
"""Force delete a server.""" """Force delete a server."""