summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Leafe <ed@leafe.com>2011-07-07 15:36:39 +0000
committerEd Leafe <ed@leafe.com>2011-07-07 15:36:39 +0000
commit60a9763382ccd77735a75b6047c821477eab684e (patch)
tree9ea5b809f056dddd2359350bdb4a52eaf1ba61ce
parent6b83e1cd31f5e138af20fbd5c118d55da092eb35 (diff)
pep8 fixes
-rw-r--r--nova/tests/test_hosts.py16
-rw-r--r--nova/virt/xenapi/vmops.py4
2 files changed, 10 insertions, 10 deletions
diff --git a/nova/tests/test_hosts.py b/nova/tests/test_hosts.py
index 5a52e36e2..417737638 100644
--- a/nova/tests/test_hosts.py
+++ b/nova/tests/test_hosts.py
@@ -103,23 +103,23 @@ class HostTestCase(test.TestCase):
en_body = {"power_state": "reboot"}
result_c1 = self.controller.update(self.req, "host_c1", body=en_body)
self.assertEqual(result_c1["power_state"], "reboot")
- result_c2 = self.controller.update(self.req, "host_c2", body=en_body)
- self.assertEqual(result_c2["power_state"], "fail")
+ self.assertRaises(webob.exc.HTTPBadRequest, self.controller.update,
+ self.req, "host_c2", body=en_body)
def test_bad_power_state_value(self):
bad_body = {"power_state": "bad"}
- result = self.controller.update(self.req, "host_c1", body=bad_body)
- self.assertEqual(str(result.wrapped_exc)[:15], "400 Bad Request")
+ self.assertRaises(webob.exc.HTTPBadRequest, self.controller.update,
+ self.req, "host_c1", body=bad_body)
def test_bad_status_value(self):
bad_body = {"status": "bad"}
- result = self.controller.update(self.req, "host_c1", body=bad_body)
- self.assertEqual(str(result.wrapped_exc)[:15], "400 Bad Request")
+ self.assertRaises(webob.exc.HTTPBadRequest, self.controller.update,
+ self.req, "host_c1", body=bad_body)
def test_bad_update_key(self):
bad_body = {"crazy": "bad"}
- result = self.controller.update(self.req, "host_c1", body=bad_body)
- self.assertEqual(str(result.wrapped_exc)[:15], "400 Bad Request")
+ self.assertRaises(webob.exc.HTTPBadRequest, self.controller.update,
+ self.req, "host_c1", body=bad_body)
def test_bad_host(self):
self.assertRaises(exception.HostNotFound, self.controller.update,
diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py
index ec90ba9fe..aec802eff 100644
--- a/nova/virt/xenapi/vmops.py
+++ b/nova/virt/xenapi/vmops.py
@@ -941,7 +941,7 @@ class VMOps(object):
resp = json.loads(xenapi_resp)
except TypeError as e:
# Already logged; return the message
- return xenapi_resp.details[-1]
+ return xenapi_resp.details[-1]
return resp["status"]
def set_power_state(self, host, power_state):
@@ -952,7 +952,7 @@ class VMOps(object):
resp = json.loads(xenapi_resp)
except TypeError as e:
# Already logged; return the message
- return xenapi_resp.details[-1]
+ return xenapi_resp.details[-1]
return resp["power_state"]
def _call_xenhost(self, method, arg_dict):