Merge lp:~cerberus/nova/lp801195 into lp:~hudson-openstack/nova/trunk

Proposed by Matt Dietz
Status: Merged
Approved by: Brian Waldon
Approved revision: 1245
Merged at revision: 1265
Proposed branch: lp:~cerberus/nova/lp801195
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 45 lines (+35/-0)
1 file modified
nova/tests/api/openstack/test_servers.py (+35/-0)
To merge this branch: bzr merge lp:~cerberus/nova/lp801195
Reviewer Review Type Date Requested Status
Brian Waldon (community) Approve
Devin Carlen (community) Approve
Josh Kearney (community) Approve
Review via email: mp+67615@code.launchpad.net

Description of the change

This doesn't actually fix anything anymore, as the wsgi_refactor branch from Waldon took care of the issue. However, a couple rescue unit tests would have caught this originally, so I'm proposing this to include those.

To post a comment you must log in.
Revision history for this message
Josh Kearney (jk0) wrote :

!!!

review: Approve
Revision history for this message
Devin Carlen (devcamcar) wrote :

lgtm

review: Approve
lp:~cerberus/nova/lp801195 updated
1245. By Matt Dietz

Bad test

Revision history for this message
Brian Waldon (bcwaldon) wrote :

Good stuff, Dietz.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'nova/tests/api/openstack/test_servers.py'
2--- nova/tests/api/openstack/test_servers.py 2011-07-11 18:41:29 +0000
3+++ nova/tests/api/openstack/test_servers.py 2011-07-11 21:28:27 +0000
4@@ -1433,6 +1433,41 @@
5 self.assertEqual(res.status, '202 Accepted')
6 self.assertEqual(self.server_delete_called, True)
7
8+ def test_rescue_accepted(self):
9+ FLAGS.allow_admin_api = True
10+ body = {}
11+
12+ self.called = False
13+
14+ def rescue_mock(*args, **kwargs):
15+ self.called = True
16+
17+ self.stubs.Set(nova.compute.api.API, 'rescue', rescue_mock)
18+ req = webob.Request.blank('/v1.0/servers/1/rescue')
19+ req.method = 'POST'
20+ req.content_type = 'application/json'
21+
22+ res = req.get_response(fakes.wsgi_app())
23+
24+ self.assertEqual(self.called, True)
25+ self.assertEqual(res.status_int, 202)
26+
27+ def test_rescue_raises_handled(self):
28+ FLAGS.allow_admin_api = True
29+ body = {}
30+
31+ def rescue_mock(*args, **kwargs):
32+ raise Exception('Who cares?')
33+
34+ self.stubs.Set(nova.compute.api.API, 'rescue', rescue_mock)
35+ req = webob.Request.blank('/v1.0/servers/1/rescue')
36+ req.method = 'POST'
37+ req.content_type = 'application/json'
38+
39+ res = req.get_response(fakes.wsgi_app())
40+
41+ self.assertEqual(res.status_int, 422)
42+
43 def test_delete_server_instance_v1_1(self):
44 req = webob.Request.blank('/v1.1/servers/1')
45 req.method = 'DELETE'