Merge lp:~jelmer/loggerhead/request-method into lp:loggerhead

Proposed by Jelmer Vernooij on 2016-09-04
Status: Merged
Merged at revision: 491
Proposed branch: lp:~jelmer/loggerhead/request-method
Merge into: lp:loggerhead
Diff against target: 123 lines (+24/-12)
1 file modified
loggerhead/tests/test_controllers.py (+24/-12)
To merge this branch: bzr merge lp:~jelmer/loggerhead/request-method
Reviewer Review Type Date Requested Status
Colin Watson 2016-09-04 Approve on 2016-10-19
Review via email: mp+304868@code.launchpad.net

Description of the change

Fix running loggerhead tests with bzr-git installed, by always setting 'REQUEST_METHOD'.

To post a comment you must log in.
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'loggerhead/tests/test_controllers.py'
2--- loggerhead/tests/test_controllers.py 2012-02-09 03:25:36 +0000
3+++ loggerhead/tests/test_controllers.py 2016-09-04 15:15:37 +0000
4@@ -80,7 +80,8 @@
5 def test_get_values_smoke(self):
6 branch = self.make_bzrbranch_for_tree_shape(['a-file'])
7 branch_app = self.make_branch_app(branch)
8- env = {'SCRIPT_NAME': '', 'PATH_INFO': '/files'}
9+ env = {'SCRIPT_NAME': '', 'PATH_INFO': '/files',
10+ 'REQUEST_METHOD': 'GET'}
11 inv_ui = branch_app.lookup_app(env)
12 inv_ui.parse_args(env)
13 values = inv_ui.get_values('', {}, {})
14@@ -89,7 +90,8 @@
15 def test_json_render_smoke(self):
16 branch = self.make_bzrbranch_for_tree_shape(['a-file'])
17 branch_app = self.make_branch_app(branch)
18- env = {'SCRIPT_NAME': '', 'PATH_INFO': '/+json/files'}
19+ env = {'SCRIPT_NAME': '', 'PATH_INFO': '/+json/files',
20+ 'REQUEST_METHOD': 'GET'}
21 inv_ui = branch_app.lookup_app(env)
22 self.assertOkJsonResponse(inv_ui, env)
23
24@@ -110,7 +112,8 @@
25
26 def test_get_values(self):
27 branch_app = self.make_branch_app_for_revision_ui([], [])
28- env = {'SCRIPT_NAME': '', 'PATH_INFO': '/revision/2'}
29+ env = {'SCRIPT_NAME': '', 'PATH_INFO': '/revision/2',
30+ 'REQUEST_METHOD': 'GET'}
31 rev_ui = branch_app.lookup_app(env)
32 rev_ui.parse_args(env)
33 self.assertIsInstance(rev_ui.get_values('', {}, []), dict)
34@@ -120,7 +123,8 @@
35 [('file', 'content\n')], [('file', 'new content\n')])
36 env = {'SCRIPT_NAME': '/',
37 'PATH_INFO': '/revision/1/non-existent-file',
38- 'QUERY_STRING':'start_revid=1' }
39+ 'QUERY_STRING':'start_revid=1',
40+ 'REQUEST_METHOD': 'GET'}
41 revision_ui = branch_app.lookup_app(env)
42 path = revision_ui.parse_args(env)
43 values = revision_ui.get_values(path, revision_ui.kwargs, {})
44@@ -132,7 +136,8 @@
45 [('file', 'content\n'), ('other-file', 'other\n')],
46 [('file', 'new content\n')])
47 env = {'SCRIPT_NAME': '/',
48- 'PATH_INFO': '/revision/head:'}
49+ 'PATH_INFO': '/revision/head:',
50+ 'REQUEST_METHOD': 'GET'}
51 revision_ui = branch_app.lookup_app(env)
52 revision_ui.parse_args(env)
53 values = revision_ui.get_values('', {}, {})
54@@ -146,7 +151,8 @@
55 branch_app = self.make_branch_app_for_revision_ui(
56 [('file', 'content\n'), ('other-file', 'other\n')],
57 [('file', 'new content\n')])
58- env = {'SCRIPT_NAME': '', 'PATH_INFO': '/+json/revision/head:'}
59+ env = {'SCRIPT_NAME': '', 'PATH_INFO': '/+json/revision/head:',
60+ 'REQUEST_METHOD': 'GET'}
61 revision_ui = branch_app.lookup_app(env)
62 self.assertOkJsonResponse(revision_ui, env)
63
64@@ -231,7 +237,8 @@
65 def test_get_values_smoke(self):
66 branch_app = self.make_branch_app_for_filediff_ui()
67 env = {'SCRIPT_NAME': '/',
68- 'PATH_INFO': '/+filediff/rev-2-id/rev-1-id/f-id'}
69+ 'PATH_INFO': '/+filediff/rev-2-id/rev-1-id/f-id',
70+ 'REQUEST_METHOD': 'GET'}
71 filediff_ui = branch_app.lookup_app(env)
72 filediff_ui.parse_args(env)
73 values = filediff_ui.get_values('', {}, {})
74@@ -242,7 +249,8 @@
75 def test_json_render_smoke(self):
76 branch_app = self.make_branch_app_for_filediff_ui()
77 env = {'SCRIPT_NAME': '/',
78- 'PATH_INFO': '/+json/+filediff/rev-2-id/rev-1-id/f-id'}
79+ 'PATH_INFO': '/+json/+filediff/rev-2-id/rev-1-id/f-id',
80+ 'REQUEST_METHOD': 'GET'}
81 filediff_ui = branch_app.lookup_app(env)
82 self.assertOkJsonResponse(filediff_ui, env)
83
84@@ -264,7 +272,8 @@
85 def test_get_values_smoke(self):
86 branch_app = self.make_branch_app_for_revlog_ui()
87 env = {'SCRIPT_NAME': '/',
88- 'PATH_INFO': '/+revlog/rev-id'}
89+ 'PATH_INFO': '/+revlog/rev-id',
90+ 'REQUEST_METHOD': 'GET'}
91 revlog_ui = branch_app.lookup_app(env)
92 revlog_ui.parse_args(env)
93 values = revlog_ui.get_values('', {}, {})
94@@ -273,7 +282,8 @@
95
96 def test_json_render_smoke(self):
97 branch_app = self.make_branch_app_for_revlog_ui()
98- env = {'SCRIPT_NAME': '', 'PATH_INFO': '/+json/+revlog/rev-id'}
99+ env = {'SCRIPT_NAME': '', 'PATH_INFO': '/+json/+revlog/rev-id',
100+ 'REQUEST_METHOD': 'GET'}
101 revlog_ui = branch_app.lookup_app(env)
102 self.assertOkJsonResponse(revlog_ui, env)
103
104@@ -284,7 +294,8 @@
105 return
106 # A hook that returns None doesn't influence the searching for
107 # a controller.
108- env = {'SCRIPT_NAME': '', 'PATH_INFO': '/custom'}
109+ env = {'SCRIPT_NAME': '', 'PATH_INFO': '/custom',
110+ 'REQUEST_METHOD': 'GET'}
111 myhook = lambda app, environ: None
112 branch = self.make_branch('.')
113 self.addCleanup(branch.lock_read().unlock)
114@@ -296,7 +307,8 @@
115
116 def test_working_hook(self):
117 # A hook can provide an app to use for a particular request.
118- env = {'SCRIPT_NAME': '', 'PATH_INFO': '/custom'}
119+ env = {'SCRIPT_NAME': '', 'PATH_INFO': '/custom',
120+ 'REQUEST_METHOD': 'GET'}
121 myhook = lambda app, environ: "I am hooked"
122 branch = self.make_branch('.')
123 self.addCleanup(branch.lock_read().unlock)

Subscribers

People subscribed via source and target branches