Merge lp:~soren/nova/no-body-in-tests-for-bodyless-requst-methods into lp:~hudson-openstack/nova/trunk

Proposed by Soren Hansen
Status: Merged
Approved by: Ed Leafe
Approved revision: 1178
Merged at revision: 1202
Proposed branch: lp:~soren/nova/no-body-in-tests-for-bodyless-requst-methods
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 59 lines (+5/-6)
4 files modified
nova/tests/api/openstack/test_limits.py (+1/-2)
nova/tests/api/openstack/test_servers.py (+1/-1)
nova/tests/api/openstack/test_wsgi.py (+2/-2)
tools/pip-requires (+1/-1)
To merge this branch: bzr merge lp:~soren/nova/no-body-in-tests-for-bodyless-requst-methods
Reviewer Review Type Date Requested Status
Ed Leafe (community) Approve
Brian Waldon (community) Approve
Review via email: mp+65333@code.launchpad.net

Commit message

Stop trying to set a body for HTTP methods that do not allow it. It renders the unit tests useless (since they're testing a situation that can never arise) and webob 1.0.8 fails if you do this.

To post a comment you must log in.
Revision history for this message
Brian Waldon (bcwaldon) wrote :

Should this change go in when we actually update to WebOb 1.0.8? Other than that, this looks good.

Revision history for this message
Brian Waldon (bcwaldon) :
review: Needs Information
Revision history for this message
Soren Hansen (soren) wrote :

> Should this change go in when we actually update to WebOb 1.0.8? Other than
> that, this looks good.

a) I don't see any particular reason to wait?

b) python-webob 1.0.8 is now the current webob in the PPA for all of Lucid, Maverick, Natty and is the current in Oneiric proper, so I guess a) is sort of moot :)

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

Ok, I just wanted to see pip-requires updated. As long as that is absolutely going to happen, this is fine.

review: Approve
1178. By Soren Hansen

Bump WebOb requirement to 1.0.8 in pip-requires.

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

Double approve!

review: Approve
Revision history for this message
Ed Leafe (ed-leafe) wrote :

lgtm

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_limits.py'
2--- nova/tests/api/openstack/test_limits.py 2011-05-26 16:06:54 +0000
3+++ nova/tests/api/openstack/test_limits.py 2011-06-21 15:04:39 +0000
4@@ -672,8 +672,7 @@
5 """Only POSTs should work."""
6 requests = []
7 for method in ["GET", "PUT", "DELETE", "HEAD", "OPTIONS"]:
8- request = webob.Request.blank("/")
9- request.body = self._request_data("GET", "/something")
10+ request = webob.Request.blank("/", method=method)
11 response = request.get_response(self.app)
12 self.assertEqual(response.status_int, 405)
13
14
15=== modified file 'nova/tests/api/openstack/test_servers.py'
16--- nova/tests/api/openstack/test_servers.py 2011-06-17 23:53:30 +0000
17+++ nova/tests/api/openstack/test_servers.py 2011-06-21 15:04:39 +0000
18@@ -1502,7 +1502,7 @@
19 self.assertEqual(res.status_int, 400)
20
21 def test_resized_server_has_correct_status(self):
22- req = self.webreq('/1', 'GET', dict(resize=dict(flavorId=3)))
23+ req = self.webreq('/1', 'GET')
24
25 def fake_migration_get(*args):
26 return {}
27
28=== modified file 'nova/tests/api/openstack/test_wsgi.py'
29--- nova/tests/api/openstack/test_wsgi.py 2011-06-13 20:00:14 +0000
30+++ nova/tests/api/openstack/test_wsgi.py 2011-06-21 15:04:39 +0000
31@@ -10,13 +10,13 @@
32
33 class RequestTest(test.TestCase):
34 def test_content_type_missing(self):
35- request = wsgi.Request.blank('/tests/123')
36+ request = wsgi.Request.blank('/tests/123', method='POST')
37 request.body = "<body />"
38 self.assertRaises(exception.InvalidContentType,
39 request.get_content_type)
40
41 def test_content_type_unsupported(self):
42- request = wsgi.Request.blank('/tests/123')
43+ request = wsgi.Request.blank('/tests/123', method='POST')
44 request.headers["Content-Type"] = "text/html"
45 request.body = "asdf<br />"
46 self.assertRaises(exception.InvalidContentType,
47
48=== modified file 'tools/pip-requires'
49--- tools/pip-requires 2011-06-15 16:52:02 +0000
50+++ tools/pip-requires 2011-06-21 15:04:39 +0000
51@@ -15,7 +15,7 @@
52 python-gflags==1.3
53 redis==2.0.0
54 routes==1.12.3
55-WebOb==0.9.8
56+WebOb==1.0.8
57 wsgiref==0.1.2
58 mox==0.5.3
59 greenlet==0.3.1