summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorEd Leafe <ed@leafe.com>2011-08-08 15:34:04 +0000
committerEd Leafe <ed@leafe.com>2011-08-08 15:34:04 +0000
commit6dcea0da62e881eaeb02027ea868d49c2402209d (patch)
treed7195fb631676bc6b880a46cc85b2af6d4289543 /nova/tests
parent966b7218a0fc96222e0ef0a22526f1bf3e7f2a9c (diff)
parenteb66810f6034a29724630e89739217a83b858d86 (diff)
Merged trunk
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/test_hosts.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/nova/tests/test_hosts.py b/nova/tests/test_hosts.py
index 548f81f8b..cd22571e6 100644
--- a/nova/tests/test_hosts.py
+++ b/nova/tests/test_hosts.py
@@ -48,6 +48,10 @@ def stub_set_host_enabled(context, host, enabled):
return status
+def stub_host_power_action(context, host, action):
+ return action
+
+
class FakeRequest(object):
environ = {"nova.context": context.get_admin_context()}
@@ -62,6 +66,8 @@ class HostTestCase(test.TestCase):
self.stubs.Set(scheduler_api, 'get_host_list', stub_get_host_list)
self.stubs.Set(self.controller.compute_api, 'set_host_enabled',
stub_set_host_enabled)
+ self.stubs.Set(self.controller.compute_api, 'host_power_action',
+ stub_host_power_action)
def test_list_hosts(self):
"""Verify that the compute hosts are returned."""
@@ -87,6 +93,19 @@ class HostTestCase(test.TestCase):
result_c2 = self.controller.update(self.req, "host_c2", body=en_body)
self.assertEqual(result_c2["status"], "disabled")
+ def test_host_startup(self):
+ self.assertRaises(webob.exc.HTTPBadRequest, self.controller.startup,
+ self.req, "host_c1")
+
+ def test_host_shutdown(self):
+ result = self.controller.shutdown(self.req, "host_c1")
+ print "RES", result
+ self.assertEqual(result["power_action"], "shutdown")
+
+ def test_host_reboot(self):
+ result = self.controller.reboot(self.req, "host_c1")
+ self.assertEqual(result["power_action"], "reboot")
+
def test_bad_status_value(self):
bad_body = {"status": "bad"}
self.assertRaises(webob.exc.HTTPBadRequest, self.controller.update,