summaryrefslogtreecommitdiff
path: root/nova/tests/api
diff options
context:
space:
mode:
Diffstat (limited to 'nova/tests/api')
-rw-r--r--nova/tests/api/openstack/compute/test_server_actions.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/nova/tests/api/openstack/compute/test_server_actions.py b/nova/tests/api/openstack/compute/test_server_actions.py
index 3fedb1ef72..c9d5403e19 100644
--- a/nova/tests/api/openstack/compute/test_server_actions.py
+++ b/nova/tests/api/openstack/compute/test_server_actions.py
@@ -16,6 +16,7 @@
import base64
import uuid
+import mock
import mox
from oslo.config import cfg
import webob
@@ -866,6 +867,16 @@ class ServerActionsControllerTest(test.TestCase):
self.controller._action_resize,
req, FAKE_UUID, body)
+ @mock.patch('nova.compute.api.API.resize',
+ side_effect=exception.NoValidHost(reason=''))
+ def test_resize_raises_no_valid_host(self, mock_resize):
+ body = dict(resize=dict(flavorRef="http://localhost/3"))
+
+ req = fakes.HTTPRequest.blank(self.url)
+ self.assertRaises(webob.exc.HTTPBadRequest,
+ self.controller._action_resize,
+ req, FAKE_UUID, body)
+
def test_confirm_resize_server(self):
body = dict(confirmResize=None)