Adds test for HTTPUnprocessableEntity when rebooting

Implements a test for 'HTTPUnprocessableEntity' error when rebooting
an instance.

Fixes Bug 1088672.

Change-Id: I7a658f4f09c871a43d20fd6fa60d4ad69784ce7d
This commit is contained in:
Tiago Mello 2012-12-28 16:45:08 -02:00
parent 32eb83be79
commit f21a3abd61

View File

@ -193,6 +193,18 @@ class ServerActionsControllerTest(test.TestCase):
self.controller._action_reboot,
req, FAKE_UUID, body)
def test_reboot_raises_unprocessable_entity(self):
body = dict(reboot=dict(type="HARD"))
def fake_reboot(*args, **kwargs):
raise NotImplementedError()
self.stubs.Set(compute_api.API, 'reboot', fake_reboot)
req = fakes.HTTPRequest.blank(self.url)
self.assertRaises(webob.exc.HTTPUnprocessableEntity,
self.controller._action_reboot,
req, FAKE_UUID, body)
def test_rebuild_accepted_minimum(self):
return_server = fakes.fake_instance_get(image_ref='2',
vm_state=vm_states.ACTIVE, host='fake_host')