@@ -0,0 +1,81 | |||
|
1 | # Redmine - project management software | |
|
2 | # Copyright (C) 2006-2011 Jean-Philippe Lang | |
|
3 | # | |
|
4 | # This program is free software; you can redistribute it and/or | |
|
5 | # modify it under the terms of the GNU General Public License | |
|
6 | # as published by the Free Software Foundation; either version 2 | |
|
7 | # of the License, or (at your option) any later version. | |
|
8 | # | |
|
9 | # This program is distributed in the hope that it will be useful, | |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
|
12 | # GNU General Public License for more details. | |
|
13 | # | |
|
14 | # You should have received a copy of the GNU General Public License | |
|
15 | # along with this program; if not, write to the Free Software | |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
|
17 | ||
|
18 | require File.expand_path('../../../test_helper', __FILE__) | |
|
19 | ||
|
20 | class RoutingIssueRelationsTest < ActionController::IntegrationTest | |
|
21 | def test_issue_relations | |
|
22 | assert_routing( | |
|
23 | { :method => 'get', :path => "/issues/1/relations" }, | |
|
24 | { :controller => 'issue_relations', :action => 'index', | |
|
25 | :issue_id => '1' } | |
|
26 | ) | |
|
27 | assert_routing( | |
|
28 | { :method => 'get', :path => "/issues/1/relations.xml" }, | |
|
29 | { :controller => 'issue_relations', :action => 'index', | |
|
30 | :issue_id => '1', :format => 'xml' } | |
|
31 | ) | |
|
32 | assert_routing( | |
|
33 | { :method => 'get', :path => "/issues/1/relations.json" }, | |
|
34 | { :controller => 'issue_relations', :action => 'index', | |
|
35 | :issue_id => '1', :format => 'json' } | |
|
36 | ) | |
|
37 | assert_routing( | |
|
38 | { :method => 'post', :path => "/issues/1/relations" }, | |
|
39 | { :controller => 'issue_relations', :action => 'create', | |
|
40 | :issue_id => '1' } | |
|
41 | ) | |
|
42 | assert_routing( | |
|
43 | { :method => 'post', :path => "/issues/1/relations.xml" }, | |
|
44 | { :controller => 'issue_relations', :action => 'create', | |
|
45 | :issue_id => '1', :format => 'xml' } | |
|
46 | ) | |
|
47 | assert_routing( | |
|
48 | { :method => 'post', :path => "/issues/1/relations.json" }, | |
|
49 | { :controller => 'issue_relations', :action => 'create', | |
|
50 | :issue_id => '1', :format => 'json' } | |
|
51 | ) | |
|
52 | assert_routing( | |
|
53 | { :method => 'get', :path => "/relations/23" }, | |
|
54 | { :controller => 'issue_relations', :action => 'show', :id => '23' } | |
|
55 | ) | |
|
56 | assert_routing( | |
|
57 | { :method => 'get', :path => "/relations/23.xml" }, | |
|
58 | { :controller => 'issue_relations', :action => 'show', :id => '23', | |
|
59 | :format => 'xml' } | |
|
60 | ) | |
|
61 | assert_routing( | |
|
62 | { :method => 'get', :path => "/relations/23.json" }, | |
|
63 | { :controller => 'issue_relations', :action => 'show', :id => '23', | |
|
64 | :format => 'json' } | |
|
65 | ) | |
|
66 | assert_routing( | |
|
67 | { :method => 'delete', :path => "/relations/23" }, | |
|
68 | { :controller => 'issue_relations', :action => 'destroy', :id => '23' } | |
|
69 | ) | |
|
70 | assert_routing( | |
|
71 | { :method => 'delete', :path => "/relations/23.xml" }, | |
|
72 | { :controller => 'issue_relations', :action => 'destroy', :id => '23', | |
|
73 | :format => 'xml' } | |
|
74 | ) | |
|
75 | assert_routing( | |
|
76 | { :method => 'delete', :path => "/relations/23.json" }, | |
|
77 | { :controller => 'issue_relations', :action => 'destroy', :id => '23', | |
|
78 | :format => 'json' } | |
|
79 | ) | |
|
80 | end | |
|
81 | end |
@@ -1,1154 +1,1093 | |||
|
1 | 1 | # Redmine - project management software |
|
2 | 2 | # Copyright (C) 2006-2011 Jean-Philippe Lang |
|
3 | 3 | # |
|
4 | 4 | # This program is free software; you can redistribute it and/or |
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 | 8 | # |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 | 13 | # |
|
14 | 14 | # You should have received a copy of the GNU General Public License |
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
17 | 17 | |
|
18 | 18 | require File.expand_path('../../test_helper', __FILE__) |
|
19 | 19 | |
|
20 | 20 | class RoutingTest < ActionController::IntegrationTest |
|
21 | 21 | def test_issues_rest_actions |
|
22 | 22 | assert_routing( |
|
23 | 23 | { :method => 'get', :path => "/issues" }, |
|
24 | 24 | { :controller => 'issues', :action => 'index' } |
|
25 | 25 | ) |
|
26 | 26 | assert_routing( |
|
27 | 27 | { :method => 'get', :path => "/issues.pdf" }, |
|
28 | 28 | { :controller => 'issues', :action => 'index', :format => 'pdf' } |
|
29 | 29 | ) |
|
30 | 30 | assert_routing( |
|
31 | 31 | { :method => 'get', :path => "/issues.atom" }, |
|
32 | 32 | { :controller => 'issues', :action => 'index', :format => 'atom' } |
|
33 | 33 | ) |
|
34 | 34 | assert_routing( |
|
35 | 35 | { :method => 'get', :path => "/issues.xml" }, |
|
36 | 36 | { :controller => 'issues', :action => 'index', :format => 'xml' } |
|
37 | 37 | ) |
|
38 | 38 | assert_routing( |
|
39 | 39 | { :method => 'get', :path => "/projects/23/issues" }, |
|
40 | 40 | { :controller => 'issues', :action => 'index', :project_id => '23' } |
|
41 | 41 | ) |
|
42 | 42 | assert_routing( |
|
43 | 43 | { :method => 'get', :path => "/projects/23/issues.pdf" }, |
|
44 | 44 | { :controller => 'issues', :action => 'index', :project_id => '23', |
|
45 | 45 | :format => 'pdf' } |
|
46 | 46 | ) |
|
47 | 47 | assert_routing( |
|
48 | 48 | { :method => 'get', :path => "/projects/23/issues.atom" }, |
|
49 | 49 | { :controller => 'issues', :action => 'index', :project_id => '23', |
|
50 | 50 | :format => 'atom' } |
|
51 | 51 | ) |
|
52 | 52 | assert_routing( |
|
53 | 53 | { :method => 'get', :path => "/projects/23/issues.xml" }, |
|
54 | 54 | { :controller => 'issues', :action => 'index', :project_id => '23', |
|
55 | 55 | :format => 'xml' } |
|
56 | 56 | ) |
|
57 | 57 | assert_routing( |
|
58 | 58 | { :method => 'get', :path => "/issues/64" }, |
|
59 | 59 | { :controller => 'issues', :action => 'show', :id => '64' } |
|
60 | 60 | ) |
|
61 | 61 | assert_routing( |
|
62 | 62 | { :method => 'get', :path => "/issues/64.pdf" }, |
|
63 | 63 | { :controller => 'issues', :action => 'show', :id => '64', |
|
64 | 64 | :format => 'pdf' } |
|
65 | 65 | ) |
|
66 | 66 | assert_routing( |
|
67 | 67 | { :method => 'get', :path => "/issues/64.atom" }, |
|
68 | 68 | { :controller => 'issues', :action => 'show', :id => '64', |
|
69 | 69 | :format => 'atom' } |
|
70 | 70 | ) |
|
71 | 71 | assert_routing( |
|
72 | 72 | { :method => 'get', :path => "/issues/64.xml" }, |
|
73 | 73 | { :controller => 'issues', :action => 'show', :id => '64', |
|
74 | 74 | :format => 'xml' } |
|
75 | 75 | ) |
|
76 | 76 | assert_routing( |
|
77 | 77 | { :method => 'get', :path => "/projects/23/issues/new" }, |
|
78 | 78 | { :controller => 'issues', :action => 'new', :project_id => '23' } |
|
79 | 79 | ) |
|
80 | 80 | end |
|
81 | 81 | |
|
82 | 82 | def test_issues_form_update |
|
83 | 83 | assert_routing( |
|
84 | 84 | { :method => 'post', :path => "/projects/23/issues/new" }, |
|
85 | 85 | { :controller => 'issues', :action => 'new', :project_id => '23' } |
|
86 | 86 | ) |
|
87 | 87 | assert_routing( |
|
88 | 88 | { :method => 'post', :path => "/projects/23/issues" }, |
|
89 | 89 | { :controller => 'issues', :action => 'create', :project_id => '23' } |
|
90 | 90 | ) |
|
91 | 91 | assert_routing( |
|
92 | 92 | { :method => 'post', :path => "/issues.xml" }, |
|
93 | 93 | { :controller => 'issues', :action => 'create', :format => 'xml' } |
|
94 | 94 | ) |
|
95 | 95 | assert_routing( |
|
96 | 96 | { :method => 'get', :path => "/issues/64/edit" }, |
|
97 | 97 | { :controller => 'issues', :action => 'edit', :id => '64' } |
|
98 | 98 | ) |
|
99 | 99 | assert_routing( |
|
100 | 100 | { :method => 'put', :path => "/issues/1.xml" }, |
|
101 | 101 | { :controller => 'issues', :action => 'update', :id => '1', |
|
102 | 102 | :format => 'xml' } |
|
103 | 103 | ) |
|
104 | 104 | assert_routing( |
|
105 | 105 | { :method => 'delete', :path => "/issues/1.xml" }, |
|
106 | 106 | { :controller => 'issues', :action => 'destroy', :id => '1', |
|
107 | 107 | :format => 'xml' } |
|
108 | 108 | ) |
|
109 | 109 | end |
|
110 | 110 | |
|
111 | 111 | def test_issues_extra_actions |
|
112 | 112 | assert_routing( |
|
113 | 113 | { :method => 'get', :path => "/projects/23/issues/64/copy" }, |
|
114 | 114 | { :controller => 'issues', :action => 'new', :project_id => '23', |
|
115 | 115 | :copy_from => '64' } |
|
116 | 116 | ) |
|
117 | 117 | assert_routing( |
|
118 | 118 | { :method => 'get', :path => "/issues/gantt" }, |
|
119 | 119 | { :controller => 'gantts', :action => 'show' } |
|
120 | 120 | ) |
|
121 | 121 | assert_routing( |
|
122 | 122 | { :method => 'get', :path => "/issues/gantt.pdf" }, |
|
123 | 123 | { :controller => 'gantts', :action => 'show', :format => 'pdf' } |
|
124 | 124 | ) |
|
125 | 125 | assert_routing( |
|
126 | 126 | { :method => 'get', :path => "/projects/project-name/issues/gantt" }, |
|
127 | 127 | { :controller => 'gantts', :action => 'show', |
|
128 | 128 | :project_id => 'project-name' } |
|
129 | 129 | ) |
|
130 | 130 | assert_routing( |
|
131 | 131 | { :method => 'get', :path => "/projects/project-name/issues/gantt.pdf" }, |
|
132 | 132 | { :controller => 'gantts', :action => 'show', |
|
133 | 133 | :project_id => 'project-name', :format => 'pdf' } |
|
134 | 134 | ) |
|
135 | 135 | assert_routing( |
|
136 | 136 | { :method => 'get', :path => "/issues/auto_complete" }, |
|
137 | 137 | { :controller => 'auto_completes', :action => 'issues' } |
|
138 | 138 | ) |
|
139 | 139 | assert_routing( |
|
140 | 140 | { :method => 'get', :path => "/issues/preview/123" }, |
|
141 | 141 | { :controller => 'previews', :action => 'issue', :id => '123' } |
|
142 | 142 | ) |
|
143 | 143 | assert_routing( |
|
144 | 144 | { :method => 'post', :path => "/issues/preview/123" }, |
|
145 | 145 | { :controller => 'previews', :action => 'issue', :id => '123' } |
|
146 | 146 | ) |
|
147 | 147 | assert_routing( |
|
148 | 148 | { :method => 'get', :path => "/issues/context_menu" }, |
|
149 | 149 | { :controller => 'context_menus', :action => 'issues' } |
|
150 | 150 | ) |
|
151 | 151 | assert_routing( |
|
152 | 152 | { :method => 'post', :path => "/issues/context_menu" }, |
|
153 | 153 | { :controller => 'context_menus', :action => 'issues' } |
|
154 | 154 | ) |
|
155 | 155 | assert_routing( |
|
156 | 156 | { :method => 'get', :path => "/issues/bulk_edit" }, |
|
157 | 157 | { :controller => 'issues', :action => 'bulk_edit' } |
|
158 | 158 | ) |
|
159 | 159 | assert_routing( |
|
160 | 160 | { :method => 'post', :path => "/issues/bulk_update" }, |
|
161 | 161 | { :controller => 'issues', :action => 'bulk_update' } |
|
162 | 162 | ) |
|
163 | 163 | end |
|
164 | 164 | |
|
165 | 165 | def test_issue_categories |
|
166 | 166 | assert_routing( |
|
167 | 167 | { :method => 'get', :path => "/projects/foo/issue_categories" }, |
|
168 | 168 | { :controller => 'issue_categories', :action => 'index', |
|
169 | 169 | :project_id => 'foo' } |
|
170 | 170 | ) |
|
171 | 171 | assert_routing( |
|
172 | 172 | { :method => 'get', :path => "/projects/foo/issue_categories.xml" }, |
|
173 | 173 | { :controller => 'issue_categories', :action => 'index', |
|
174 | 174 | :project_id => 'foo', :format => 'xml' } |
|
175 | 175 | ) |
|
176 | 176 | assert_routing( |
|
177 | 177 | { :method => 'get', :path => "/projects/foo/issue_categories.json" }, |
|
178 | 178 | { :controller => 'issue_categories', :action => 'index', |
|
179 | 179 | :project_id => 'foo', :format => 'json' } |
|
180 | 180 | ) |
|
181 | 181 | assert_routing( |
|
182 | 182 | { :method => 'get', :path => "/projects/foo/issue_categories/new" }, |
|
183 | 183 | { :controller => 'issue_categories', :action => 'new', |
|
184 | 184 | :project_id => 'foo' } |
|
185 | 185 | ) |
|
186 | 186 | assert_routing( |
|
187 | 187 | { :method => 'post', :path => "/projects/foo/issue_categories" }, |
|
188 | 188 | { :controller => 'issue_categories', :action => 'create', |
|
189 | 189 | :project_id => 'foo' } |
|
190 | 190 | ) |
|
191 | 191 | assert_routing( |
|
192 | 192 | { :method => 'post', :path => "/projects/foo/issue_categories.xml" }, |
|
193 | 193 | { :controller => 'issue_categories', :action => 'create', |
|
194 | 194 | :project_id => 'foo', :format => 'xml' } |
|
195 | 195 | ) |
|
196 | 196 | assert_routing( |
|
197 | 197 | { :method => 'post', :path => "/projects/foo/issue_categories.json" }, |
|
198 | 198 | { :controller => 'issue_categories', :action => 'create', |
|
199 | 199 | :project_id => 'foo', :format => 'json' } |
|
200 | 200 | ) |
|
201 | 201 | assert_routing( |
|
202 | 202 | { :method => 'get', :path => "/issue_categories/1" }, |
|
203 | 203 | { :controller => 'issue_categories', :action => 'show', :id => '1' } |
|
204 | 204 | ) |
|
205 | 205 | assert_routing( |
|
206 | 206 | { :method => 'get', :path => "/issue_categories/1.xml" }, |
|
207 | 207 | { :controller => 'issue_categories', :action => 'show', :id => '1', |
|
208 | 208 | :format => 'xml' } |
|
209 | 209 | ) |
|
210 | 210 | assert_routing( |
|
211 | 211 | { :method => 'get', :path => "/issue_categories/1.json" }, |
|
212 | 212 | { :controller => 'issue_categories', :action => 'show', :id => '1', |
|
213 | 213 | :format => 'json' } |
|
214 | 214 | ) |
|
215 | 215 | assert_routing( |
|
216 | 216 | { :method => 'get', :path => "/issue_categories/1/edit" }, |
|
217 | 217 | { :controller => 'issue_categories', :action => 'edit', :id => '1' } |
|
218 | 218 | ) |
|
219 | 219 | assert_routing( |
|
220 | 220 | { :method => 'put', :path => "/issue_categories/1" }, |
|
221 | 221 | { :controller => 'issue_categories', :action => 'update', :id => '1' } |
|
222 | 222 | ) |
|
223 | 223 | assert_routing( |
|
224 | 224 | { :method => 'put', :path => "/issue_categories/1.xml" }, |
|
225 | 225 | { :controller => 'issue_categories', :action => 'update', :id => '1', |
|
226 | 226 | :format => 'xml' } |
|
227 | 227 | ) |
|
228 | 228 | assert_routing( |
|
229 | 229 | { :method => 'put', :path => "/issue_categories/1.json" }, |
|
230 | 230 | { :controller => 'issue_categories', :action => 'update', :id => '1', |
|
231 | 231 | :format => 'json' } |
|
232 | 232 | ) |
|
233 | 233 | assert_routing( |
|
234 | 234 | { :method => 'delete', :path => "/issue_categories/1" }, |
|
235 | 235 | { :controller => 'issue_categories', :action => 'destroy', :id => '1' } |
|
236 | 236 | ) |
|
237 | 237 | assert_routing( |
|
238 | 238 | { :method => 'delete', :path => "/issue_categories/1.xml" }, |
|
239 | 239 | { :controller => 'issue_categories', :action => 'destroy', :id => '1', |
|
240 | 240 | :format => 'xml' } |
|
241 | 241 | ) |
|
242 | 242 | assert_routing( |
|
243 | 243 | { :method => 'delete', :path => "/issue_categories/1.json" }, |
|
244 | 244 | { :controller => 'issue_categories', :action => 'destroy', :id => '1', |
|
245 | 245 | :format => 'json' } |
|
246 | 246 | ) |
|
247 | 247 | end |
|
248 | 248 | |
|
249 | def test_issue_relations | |
|
250 | assert_routing( | |
|
251 | { :method => 'get', :path => "/issues/1/relations" }, | |
|
252 | { :controller => 'issue_relations', :action => 'index', | |
|
253 | :issue_id => '1' } | |
|
254 | ) | |
|
255 | assert_routing( | |
|
256 | { :method => 'get', :path => "/issues/1/relations.xml" }, | |
|
257 | { :controller => 'issue_relations', :action => 'index', | |
|
258 | :issue_id => '1', :format => 'xml' } | |
|
259 | ) | |
|
260 | assert_routing( | |
|
261 | { :method => 'get', :path => "/issues/1/relations.json" }, | |
|
262 | { :controller => 'issue_relations', :action => 'index', | |
|
263 | :issue_id => '1', :format => 'json' } | |
|
264 | ) | |
|
265 | assert_routing( | |
|
266 | { :method => 'post', :path => "/issues/1/relations" }, | |
|
267 | { :controller => 'issue_relations', :action => 'create', | |
|
268 | :issue_id => '1' } | |
|
269 | ) | |
|
270 | assert_routing( | |
|
271 | { :method => 'post', :path => "/issues/1/relations.xml" }, | |
|
272 | { :controller => 'issue_relations', :action => 'create', | |
|
273 | :issue_id => '1', :format => 'xml' } | |
|
274 | ) | |
|
275 | assert_routing( | |
|
276 | { :method => 'post', :path => "/issues/1/relations.json" }, | |
|
277 | { :controller => 'issue_relations', :action => 'create', | |
|
278 | :issue_id => '1', :format => 'json' } | |
|
279 | ) | |
|
280 | assert_routing( | |
|
281 | { :method => 'get', :path => "/relations/23" }, | |
|
282 | { :controller => 'issue_relations', :action => 'show', :id => '23' } | |
|
283 | ) | |
|
284 | assert_routing( | |
|
285 | { :method => 'get', :path => "/relations/23.xml" }, | |
|
286 | { :controller => 'issue_relations', :action => 'show', :id => '23', | |
|
287 | :format => 'xml' } | |
|
288 | ) | |
|
289 | assert_routing( | |
|
290 | { :method => 'get', :path => "/relations/23.json" }, | |
|
291 | { :controller => 'issue_relations', :action => 'show', :id => '23', | |
|
292 | :format => 'json' } | |
|
293 | ) | |
|
294 | assert_routing( | |
|
295 | { :method => 'delete', :path => "/relations/23" }, | |
|
296 | { :controller => 'issue_relations', :action => 'destroy', :id => '23' } | |
|
297 | ) | |
|
298 | assert_routing( | |
|
299 | { :method => 'delete', :path => "/relations/23.xml" }, | |
|
300 | { :controller => 'issue_relations', :action => 'destroy', :id => '23', | |
|
301 | :format => 'xml' } | |
|
302 | ) | |
|
303 | assert_routing( | |
|
304 | { :method => 'delete', :path => "/relations/23.json" }, | |
|
305 | { :controller => 'issue_relations', :action => 'destroy', :id => '23', | |
|
306 | :format => 'json' } | |
|
307 | ) | |
|
308 | end | |
|
309 | ||
|
310 | 249 | def test_issue_reports |
|
311 | 250 | assert_routing( |
|
312 | 251 | { :method => 'get', :path => "/projects/567/issues/report" }, |
|
313 | 252 | { :controller => 'reports', :action => 'issue_report', :id => '567' } |
|
314 | 253 | ) |
|
315 | 254 | assert_routing( |
|
316 | 255 | { :method => 'get', :path => "/projects/567/issues/report/assigned_to" }, |
|
317 | 256 | { :controller => 'reports', :action => 'issue_report_details', |
|
318 | 257 | :id => '567', :detail => 'assigned_to' } |
|
319 | 258 | ) |
|
320 | 259 | end |
|
321 | 260 | |
|
322 | 261 | def test_members |
|
323 | 262 | assert_routing( |
|
324 | 263 | { :method => 'post', :path => "/projects/5234/members/new" }, |
|
325 | 264 | { :controller => 'members', :action => 'new', :id => '5234' } |
|
326 | 265 | ) |
|
327 | 266 | end |
|
328 | 267 | |
|
329 | 268 | def test_news |
|
330 | 269 | assert_routing( |
|
331 | 270 | { :method => 'get', :path => "/news" }, |
|
332 | 271 | { :controller => 'news', :action => 'index' } |
|
333 | 272 | ) |
|
334 | 273 | assert_routing( |
|
335 | 274 | { :method => 'get', :path => "/news.atom" }, |
|
336 | 275 | { :controller => 'news', :action => 'index', :format => 'atom' } |
|
337 | 276 | ) |
|
338 | 277 | assert_routing( |
|
339 | 278 | { :method => 'get', :path => "/news.xml" }, |
|
340 | 279 | { :controller => 'news', :action => 'index', :format => 'xml' } |
|
341 | 280 | ) |
|
342 | 281 | assert_routing( |
|
343 | 282 | { :method => 'get', :path => "/news.json" }, |
|
344 | 283 | { :controller => 'news', :action => 'index', :format => 'json' } |
|
345 | 284 | ) |
|
346 | 285 | assert_routing( |
|
347 | 286 | { :method => 'get', :path => "/projects/567/news" }, |
|
348 | 287 | { :controller => 'news', :action => 'index', :project_id => '567' } |
|
349 | 288 | ) |
|
350 | 289 | assert_routing( |
|
351 | 290 | { :method => 'get', :path => "/projects/567/news.atom" }, |
|
352 | 291 | { :controller => 'news', :action => 'index', :format => 'atom', |
|
353 | 292 | :project_id => '567' } |
|
354 | 293 | ) |
|
355 | 294 | assert_routing( |
|
356 | 295 | { :method => 'get', :path => "/projects/567/news.xml" }, |
|
357 | 296 | { :controller => 'news', :action => 'index', :format => 'xml', |
|
358 | 297 | :project_id => '567' } |
|
359 | 298 | ) |
|
360 | 299 | assert_routing( |
|
361 | 300 | { :method => 'get', :path => "/projects/567/news.json" }, |
|
362 | 301 | { :controller => 'news', :action => 'index', :format => 'json', |
|
363 | 302 | :project_id => '567' } |
|
364 | 303 | ) |
|
365 | 304 | assert_routing( |
|
366 | 305 | { :method => 'get', :path => "/news/2" }, |
|
367 | 306 | { :controller => 'news', :action => 'show', :id => '2' } |
|
368 | 307 | ) |
|
369 | 308 | assert_routing( |
|
370 | 309 | { :method => 'get', :path => "/projects/567/news/new" }, |
|
371 | 310 | { :controller => 'news', :action => 'new', :project_id => '567' } |
|
372 | 311 | ) |
|
373 | 312 | assert_routing( |
|
374 | 313 | { :method => 'get', :path => "/news/234" }, |
|
375 | 314 | { :controller => 'news', :action => 'show', :id => '234' } |
|
376 | 315 | ) |
|
377 | 316 | assert_routing( |
|
378 | 317 | { :method => 'get', :path => "/news/567/edit" }, |
|
379 | 318 | { :controller => 'news', :action => 'edit', :id => '567' } |
|
380 | 319 | ) |
|
381 | 320 | assert_routing( |
|
382 | 321 | { :method => 'get', :path => "/news/preview" }, |
|
383 | 322 | { :controller => 'previews', :action => 'news' } |
|
384 | 323 | ) |
|
385 | 324 | assert_routing( |
|
386 | 325 | { :method => 'post', :path => "/projects/567/news" }, |
|
387 | 326 | { :controller => 'news', :action => 'create', :project_id => '567' } |
|
388 | 327 | ) |
|
389 | 328 | assert_routing( |
|
390 | 329 | { :method => 'post', :path => "/news/567/comments" }, |
|
391 | 330 | { :controller => 'comments', :action => 'create', :id => '567' } |
|
392 | 331 | ) |
|
393 | 332 | assert_routing( |
|
394 | 333 | { :method => 'put', :path => "/news/567" }, |
|
395 | 334 | { :controller => 'news', :action => 'update', :id => '567' } |
|
396 | 335 | ) |
|
397 | 336 | assert_routing( |
|
398 | 337 | { :method => 'delete', :path => "/news/567" }, |
|
399 | 338 | { :controller => 'news', :action => 'destroy', :id => '567' } |
|
400 | 339 | ) |
|
401 | 340 | assert_routing( |
|
402 | 341 | { :method => 'delete', :path => "/news/567/comments/15" }, |
|
403 | 342 | { :controller => 'comments', :action => 'destroy', :id => '567', |
|
404 | 343 | :comment_id => '15' } |
|
405 | 344 | ) |
|
406 | 345 | end |
|
407 | 346 | |
|
408 | 347 | def test_projects |
|
409 | 348 | assert_routing( |
|
410 | 349 | { :method => 'get', :path => "/projects" }, |
|
411 | 350 | { :controller => 'projects', :action => 'index' } |
|
412 | 351 | ) |
|
413 | 352 | assert_routing( |
|
414 | 353 | { :method => 'get', :path => "/projects.atom" }, |
|
415 | 354 | { :controller => 'projects', :action => 'index', :format => 'atom' } |
|
416 | 355 | ) |
|
417 | 356 | assert_routing( |
|
418 | 357 | { :method => 'get', :path => "/projects.xml" }, |
|
419 | 358 | { :controller => 'projects', :action => 'index', :format => 'xml' } |
|
420 | 359 | ) |
|
421 | 360 | assert_routing( |
|
422 | 361 | { :method => 'get', :path => "/projects/new" }, |
|
423 | 362 | { :controller => 'projects', :action => 'new' } |
|
424 | 363 | ) |
|
425 | 364 | assert_routing( |
|
426 | 365 | { :method => 'get', :path => "/projects/test" }, |
|
427 | 366 | { :controller => 'projects', :action => 'show', :id => 'test' } |
|
428 | 367 | ) |
|
429 | 368 | assert_routing( |
|
430 | 369 | { :method => 'get', :path => "/projects/1.xml" }, |
|
431 | 370 | { :controller => 'projects', :action => 'show', :id => '1', |
|
432 | 371 | :format => 'xml' } |
|
433 | 372 | ) |
|
434 | 373 | assert_routing( |
|
435 | 374 | { :method => 'get', :path => "/projects/4223/settings" }, |
|
436 | 375 | { :controller => 'projects', :action => 'settings', :id => '4223' } |
|
437 | 376 | ) |
|
438 | 377 | assert_routing( |
|
439 | 378 | { :method => 'get', :path => "/projects/4223/settings/members" }, |
|
440 | 379 | { :controller => 'projects', :action => 'settings', :id => '4223', |
|
441 | 380 | :tab => 'members' } |
|
442 | 381 | ) |
|
443 | 382 | assert_routing( |
|
444 | 383 | { :method => 'get', :path => "/projects/33/files" }, |
|
445 | 384 | { :controller => 'files', :action => 'index', :project_id => '33' } |
|
446 | 385 | ) |
|
447 | 386 | assert_routing( |
|
448 | 387 | { :method => 'get', :path => "/projects/33/files/new" }, |
|
449 | 388 | { :controller => 'files', :action => 'new', :project_id => '33' } |
|
450 | 389 | ) |
|
451 | 390 | assert_routing( |
|
452 | 391 | { :method => 'get', :path => "/projects/33/roadmap" }, |
|
453 | 392 | { :controller => 'versions', :action => 'index', :project_id => '33' } |
|
454 | 393 | ) |
|
455 | 394 | assert_routing( |
|
456 | 395 | { :method => 'get', :path => "/projects/33/activity" }, |
|
457 | 396 | { :controller => 'activities', :action => 'index', :id => '33' } |
|
458 | 397 | ) |
|
459 | 398 | assert_routing( |
|
460 | 399 | { :method => 'get', :path => "/projects/33/activity.atom" }, |
|
461 | 400 | { :controller => 'activities', :action => 'index', :id => '33', |
|
462 | 401 | :format => 'atom' } |
|
463 | 402 | ) |
|
464 | 403 | assert_routing( |
|
465 | 404 | { :method => 'post', :path => "/projects" }, |
|
466 | 405 | { :controller => 'projects', :action => 'create' } |
|
467 | 406 | ) |
|
468 | 407 | assert_routing( |
|
469 | 408 | { :method => 'post', :path => "/projects.xml" }, |
|
470 | 409 | { :controller => 'projects', :action => 'create', :format => 'xml' } |
|
471 | 410 | ) |
|
472 | 411 | assert_routing( |
|
473 | 412 | { :method => 'post', :path => "/projects/33/files" }, |
|
474 | 413 | { :controller => 'files', :action => 'create', :project_id => '33' } |
|
475 | 414 | ) |
|
476 | 415 | assert_routing( |
|
477 | 416 | { :method => 'post', :path => "/projects/64/archive" }, |
|
478 | 417 | { :controller => 'projects', :action => 'archive', :id => '64' } |
|
479 | 418 | ) |
|
480 | 419 | assert_routing( |
|
481 | 420 | { :method => 'post', :path => "/projects/64/unarchive" }, |
|
482 | 421 | { :controller => 'projects', :action => 'unarchive', :id => '64' } |
|
483 | 422 | ) |
|
484 | 423 | assert_routing( |
|
485 | 424 | { :method => 'put', :path => "/projects/64/enumerations" }, |
|
486 | 425 | { :controller => 'project_enumerations', :action => 'update', |
|
487 | 426 | :project_id => '64' } |
|
488 | 427 | ) |
|
489 | 428 | assert_routing( |
|
490 | 429 | { :method => 'put', :path => "/projects/4223" }, |
|
491 | 430 | { :controller => 'projects', :action => 'update', :id => '4223' } |
|
492 | 431 | ) |
|
493 | 432 | assert_routing( |
|
494 | 433 | { :method => 'put', :path => "/projects/1.xml" }, |
|
495 | 434 | { :controller => 'projects', :action => 'update', :id => '1', |
|
496 | 435 | :format => 'xml' } |
|
497 | 436 | ) |
|
498 | 437 | assert_routing( |
|
499 | 438 | { :method => 'delete', :path => "/projects/64" }, |
|
500 | 439 | { :controller => 'projects', :action => 'destroy', :id => '64' } |
|
501 | 440 | ) |
|
502 | 441 | assert_routing( |
|
503 | 442 | { :method => 'delete', :path => "/projects/1.xml" }, |
|
504 | 443 | { :controller => 'projects', :action => 'destroy', :id => '1', |
|
505 | 444 | :format => 'xml' } |
|
506 | 445 | ) |
|
507 | 446 | assert_routing( |
|
508 | 447 | { :method => 'delete', :path => "/projects/64/enumerations" }, |
|
509 | 448 | { :controller => 'project_enumerations', :action => 'destroy', |
|
510 | 449 | :project_id => '64' } |
|
511 | 450 | ) |
|
512 | 451 | end |
|
513 | 452 | |
|
514 | 453 | def test_queries |
|
515 | 454 | assert_routing( |
|
516 | 455 | { :method => 'get', :path => "/queries.xml" }, |
|
517 | 456 | { :controller => 'queries', :action => 'index', :format => 'xml' } |
|
518 | 457 | ) |
|
519 | 458 | assert_routing( |
|
520 | 459 | { :method => 'get', :path => "/queries.json" }, |
|
521 | 460 | { :controller => 'queries', :action => 'index', :format => 'json' } |
|
522 | 461 | ) |
|
523 | 462 | assert_routing( |
|
524 | 463 | { :method => 'get', :path => "/queries/new" }, |
|
525 | 464 | { :controller => 'queries', :action => 'new' } |
|
526 | 465 | ) |
|
527 | 466 | assert_routing( |
|
528 | 467 | { :method => 'get', :path => "/projects/redmine/queries/new" }, |
|
529 | 468 | { :controller => 'queries', :action => 'new', :project_id => 'redmine' } |
|
530 | 469 | ) |
|
531 | 470 | assert_routing( |
|
532 | 471 | { :method => 'post', :path => "/queries" }, |
|
533 | 472 | { :controller => 'queries', :action => 'create' } |
|
534 | 473 | ) |
|
535 | 474 | assert_routing( |
|
536 | 475 | { :method => 'post', :path => "/projects/redmine/queries" }, |
|
537 | 476 | { :controller => 'queries', :action => 'create', :project_id => 'redmine' } |
|
538 | 477 | ) |
|
539 | 478 | assert_routing( |
|
540 | 479 | { :method => 'get', :path => "/queries/1/edit" }, |
|
541 | 480 | { :controller => 'queries', :action => 'edit', :id => '1' } |
|
542 | 481 | ) |
|
543 | 482 | assert_routing( |
|
544 | 483 | { :method => 'put', :path => "/queries/1" }, |
|
545 | 484 | { :controller => 'queries', :action => 'update', :id => '1' } |
|
546 | 485 | ) |
|
547 | 486 | assert_routing( |
|
548 | 487 | { :method => 'delete', :path => "/queries/1" }, |
|
549 | 488 | { :controller => 'queries', :action => 'destroy', :id => '1' } |
|
550 | 489 | ) |
|
551 | 490 | end |
|
552 | 491 | |
|
553 | 492 | def test_repositories |
|
554 | 493 | assert_routing( |
|
555 | 494 | { :method => 'get', |
|
556 | 495 | :path => "/projects/redmine/repository" }, |
|
557 | 496 | { :controller => 'repositories', :action => 'show', :id => 'redmine' } |
|
558 | 497 | ) |
|
559 | 498 | assert_routing( |
|
560 | 499 | { :method => 'get', |
|
561 | 500 | :path => "/projects/redmine/repository/edit" }, |
|
562 | 501 | { :controller => 'repositories', :action => 'edit', :id => 'redmine' } |
|
563 | 502 | ) |
|
564 | 503 | assert_routing( |
|
565 | 504 | { :method => 'get', |
|
566 | 505 | :path => "/projects/redmine/repository/revisions" }, |
|
567 | 506 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine' } |
|
568 | 507 | ) |
|
569 | 508 | assert_routing( |
|
570 | 509 | { :method => 'get', |
|
571 | 510 | :path => "/projects/redmine/repository/revisions.atom" }, |
|
572 | 511 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine', |
|
573 | 512 | :format => 'atom' } |
|
574 | 513 | ) |
|
575 | 514 | assert_routing( |
|
576 | 515 | { :method => 'get', |
|
577 | 516 | :path => "/projects/redmine/repository/revisions/2457" }, |
|
578 | 517 | { :controller => 'repositories', :action => 'revision', :id => 'redmine', |
|
579 | 518 | :rev => '2457' } |
|
580 | 519 | ) |
|
581 | 520 | assert_routing( |
|
582 | 521 | { :method => 'get', |
|
583 | 522 | :path => "/projects/redmine/repository/revisions/2457/diff" }, |
|
584 | 523 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', |
|
585 | 524 | :rev => '2457' } |
|
586 | 525 | ) |
|
587 | 526 | assert_routing( |
|
588 | 527 | { :method => 'get', |
|
589 | 528 | :path => "/projects/redmine/repository/revisions/2457/diff.diff" }, |
|
590 | 529 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', |
|
591 | 530 | :rev => '2457', :format => 'diff' } |
|
592 | 531 | ) |
|
593 | 532 | assert_routing( |
|
594 | 533 | { :method => 'get', |
|
595 | 534 | :path => "/projects/redmine/repository/diff/path/to/file.c" }, |
|
596 | 535 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', |
|
597 | 536 | :path => %w[path to file.c] } |
|
598 | 537 | ) |
|
599 | 538 | assert_routing( |
|
600 | 539 | { :method => 'get', |
|
601 | 540 | :path => "/projects/redmine/repository/revisions/2/diff/path/to/file.c" }, |
|
602 | 541 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', |
|
603 | 542 | :path => %w[path to file.c], :rev => '2' } |
|
604 | 543 | ) |
|
605 | 544 | assert_routing( |
|
606 | 545 | { :method => 'get', |
|
607 | 546 | :path => "/projects/redmine/repository/browse/path/to/file.c" }, |
|
608 | 547 | { :controller => 'repositories', :action => 'browse', :id => 'redmine', |
|
609 | 548 | :path => %w[path to file.c] } |
|
610 | 549 | ) |
|
611 | 550 | assert_routing( |
|
612 | 551 | { :method => 'get', |
|
613 | 552 | :path => "/projects/redmine/repository/entry/path/to/file.c" }, |
|
614 | 553 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', |
|
615 | 554 | :path => %w[path to file.c] } |
|
616 | 555 | ) |
|
617 | 556 | assert_routing( |
|
618 | 557 | { :method => 'get', |
|
619 | 558 | :path => "/projects/redmine/repository/revisions/2/entry/path/to/file.c" }, |
|
620 | 559 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', |
|
621 | 560 | :path => %w[path to file.c], :rev => '2' } |
|
622 | 561 | ) |
|
623 | 562 | assert_routing( |
|
624 | 563 | { :method => 'get', |
|
625 | 564 | :path => "/projects/redmine/repository/raw/path/to/file.c" }, |
|
626 | 565 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', |
|
627 | 566 | :path => %w[path to file.c], :format => 'raw' } |
|
628 | 567 | ) |
|
629 | 568 | assert_routing( |
|
630 | 569 | { :method => 'get', |
|
631 | 570 | :path => "/projects/redmine/repository/revisions/2/raw/path/to/file.c" }, |
|
632 | 571 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', |
|
633 | 572 | :path => %w[path to file.c], :rev => '2', :format => 'raw' } |
|
634 | 573 | ) |
|
635 | 574 | assert_routing( |
|
636 | 575 | { :method => 'get', |
|
637 | 576 | :path => "/projects/redmine/repository/annotate/path/to/file.c" }, |
|
638 | 577 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', |
|
639 | 578 | :path => %w[path to file.c] } |
|
640 | 579 | ) |
|
641 | 580 | assert_routing( |
|
642 | 581 | { :method => 'get', |
|
643 | 582 | :path => "/projects/redmine/repository/changes/path/to/file.c" }, |
|
644 | 583 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', |
|
645 | 584 | :path => %w[path to file.c] } |
|
646 | 585 | ) |
|
647 | 586 | assert_routing( |
|
648 | 587 | { :method => 'get', |
|
649 | 588 | :path => "/projects/redmine/repository/statistics" }, |
|
650 | 589 | { :controller => 'repositories', :action => 'stats', :id => 'redmine' } |
|
651 | 590 | ) |
|
652 | 591 | assert_routing( |
|
653 | 592 | { :method => 'post', |
|
654 | 593 | :path => "/projects/redmine/repository/edit" }, |
|
655 | 594 | { :controller => 'repositories', :action => 'edit', :id => 'redmine' } |
|
656 | 595 | ) |
|
657 | 596 | end |
|
658 | 597 | |
|
659 | 598 | def test_roles |
|
660 | 599 | assert_routing( |
|
661 | 600 | { :method => 'get', :path => "/roles" }, |
|
662 | 601 | { :controller => 'roles', :action => 'index' } |
|
663 | 602 | ) |
|
664 | 603 | assert_routing( |
|
665 | 604 | { :method => 'get', :path => "/roles/new" }, |
|
666 | 605 | { :controller => 'roles', :action => 'new' } |
|
667 | 606 | ) |
|
668 | 607 | assert_routing( |
|
669 | 608 | { :method => 'post', :path => "/roles" }, |
|
670 | 609 | { :controller => 'roles', :action => 'create' } |
|
671 | 610 | ) |
|
672 | 611 | assert_routing( |
|
673 | 612 | { :method => 'get', :path => "/roles/2/edit" }, |
|
674 | 613 | { :controller => 'roles', :action => 'edit', :id => '2' } |
|
675 | 614 | ) |
|
676 | 615 | assert_routing( |
|
677 | 616 | { :method => 'put', :path => "/roles/2" }, |
|
678 | 617 | { :controller => 'roles', :action => 'update', :id => '2' } |
|
679 | 618 | ) |
|
680 | 619 | assert_routing( |
|
681 | 620 | { :method => 'delete', :path => "/roles/2" }, |
|
682 | 621 | { :controller => 'roles', :action => 'destroy', :id => '2' } |
|
683 | 622 | ) |
|
684 | 623 | assert_routing( |
|
685 | 624 | { :method => 'get', :path => "/roles/permissions" }, |
|
686 | 625 | { :controller => 'roles', :action => 'permissions' } |
|
687 | 626 | ) |
|
688 | 627 | assert_routing( |
|
689 | 628 | { :method => 'post', :path => "/roles/permissions" }, |
|
690 | 629 | { :controller => 'roles', :action => 'permissions' } |
|
691 | 630 | ) |
|
692 | 631 | end |
|
693 | 632 | |
|
694 | 633 | def test_timelogs_global |
|
695 | 634 | assert_routing( |
|
696 | 635 | { :method => 'get', :path => "/time_entries" }, |
|
697 | 636 | { :controller => 'timelog', :action => 'index' } |
|
698 | 637 | ) |
|
699 | 638 | assert_routing( |
|
700 | 639 | { :method => 'get', :path => "/time_entries.csv" }, |
|
701 | 640 | { :controller => 'timelog', :action => 'index', :format => 'csv' } |
|
702 | 641 | ) |
|
703 | 642 | assert_routing( |
|
704 | 643 | { :method => 'get', :path => "/time_entries.atom" }, |
|
705 | 644 | { :controller => 'timelog', :action => 'index', :format => 'atom' } |
|
706 | 645 | ) |
|
707 | 646 | assert_routing( |
|
708 | 647 | { :method => 'get', :path => "/time_entries/new" }, |
|
709 | 648 | { :controller => 'timelog', :action => 'new' } |
|
710 | 649 | ) |
|
711 | 650 | assert_routing( |
|
712 | 651 | { :method => 'get', :path => "/time_entries/22/edit" }, |
|
713 | 652 | { :controller => 'timelog', :action => 'edit', :id => '22' } |
|
714 | 653 | ) |
|
715 | 654 | assert_routing( |
|
716 | 655 | { :method => 'post', :path => "/time_entries" }, |
|
717 | 656 | { :controller => 'timelog', :action => 'create' } |
|
718 | 657 | ) |
|
719 | 658 | assert_routing( |
|
720 | 659 | { :method => 'put', :path => "/time_entries/22" }, |
|
721 | 660 | { :controller => 'timelog', :action => 'update', :id => '22' } |
|
722 | 661 | ) |
|
723 | 662 | assert_routing( |
|
724 | 663 | { :method => 'delete', :path => "/time_entries/55" }, |
|
725 | 664 | { :controller => 'timelog', :action => 'destroy', :id => '55' } |
|
726 | 665 | ) |
|
727 | 666 | end |
|
728 | 667 | |
|
729 | 668 | def test_timelogs_scoped_under_project |
|
730 | 669 | assert_routing( |
|
731 | 670 | { :method => 'get', :path => "/projects/567/time_entries" }, |
|
732 | 671 | { :controller => 'timelog', :action => 'index', :project_id => '567' } |
|
733 | 672 | ) |
|
734 | 673 | assert_routing( |
|
735 | 674 | { :method => 'get', :path => "/projects/567/time_entries.csv" }, |
|
736 | 675 | { :controller => 'timelog', :action => 'index', :project_id => '567', |
|
737 | 676 | :format => 'csv' } |
|
738 | 677 | ) |
|
739 | 678 | assert_routing( |
|
740 | 679 | { :method => 'get', :path => "/projects/567/time_entries.atom" }, |
|
741 | 680 | { :controller => 'timelog', :action => 'index', :project_id => '567', |
|
742 | 681 | :format => 'atom' } |
|
743 | 682 | ) |
|
744 | 683 | assert_routing( |
|
745 | 684 | { :method => 'get', :path => "/projects/567/time_entries/new" }, |
|
746 | 685 | { :controller => 'timelog', :action => 'new', :project_id => '567' } |
|
747 | 686 | ) |
|
748 | 687 | assert_routing( |
|
749 | 688 | { :method => 'get', :path => "/projects/567/time_entries/22/edit" }, |
|
750 | 689 | { :controller => 'timelog', :action => 'edit', |
|
751 | 690 | :id => '22', :project_id => '567' } |
|
752 | 691 | ) |
|
753 | 692 | assert_routing( |
|
754 | 693 | { :method => 'post', :path => "/projects/567/time_entries" }, |
|
755 | 694 | { :controller => 'timelog', :action => 'create', |
|
756 | 695 | :project_id => '567' } |
|
757 | 696 | ) |
|
758 | 697 | assert_routing( |
|
759 | 698 | { :method => 'put', :path => "/projects/567/time_entries/22" }, |
|
760 | 699 | { :controller => 'timelog', :action => 'update', |
|
761 | 700 | :id => '22', :project_id => '567' } |
|
762 | 701 | ) |
|
763 | 702 | assert_routing( |
|
764 | 703 | { :method => 'delete', :path => "/projects/567/time_entries/55" }, |
|
765 | 704 | { :controller => 'timelog', :action => 'destroy', |
|
766 | 705 | :id => '55', :project_id => '567' } |
|
767 | 706 | ) |
|
768 | 707 | end |
|
769 | 708 | |
|
770 | 709 | def test_timelogs_scoped_under_issues |
|
771 | 710 | assert_routing( |
|
772 | 711 | { :method => 'get', :path => "/issues/234/time_entries" }, |
|
773 | 712 | { :controller => 'timelog', :action => 'index', :issue_id => '234' } |
|
774 | 713 | ) |
|
775 | 714 | assert_routing( |
|
776 | 715 | { :method => 'get', :path => "/issues/234/time_entries.csv" }, |
|
777 | 716 | { :controller => 'timelog', :action => 'index', :issue_id => '234', |
|
778 | 717 | :format => 'csv' } |
|
779 | 718 | ) |
|
780 | 719 | assert_routing( |
|
781 | 720 | { :method => 'get', :path => "/issues/234/time_entries.atom" }, |
|
782 | 721 | { :controller => 'timelog', :action => 'index', :issue_id => '234', |
|
783 | 722 | :format => 'atom' } |
|
784 | 723 | ) |
|
785 | 724 | assert_routing( |
|
786 | 725 | { :method => 'get', :path => "/issues/234/time_entries/new" }, |
|
787 | 726 | { :controller => 'timelog', :action => 'new', :issue_id => '234' } |
|
788 | 727 | ) |
|
789 | 728 | assert_routing( |
|
790 | 729 | { :method => 'get', :path => "/issues/234/time_entries/22/edit" }, |
|
791 | 730 | { :controller => 'timelog', :action => 'edit', :id => '22', |
|
792 | 731 | :issue_id => '234' } |
|
793 | 732 | ) |
|
794 | 733 | assert_routing( |
|
795 | 734 | { :method => 'post', :path => "/issues/234/time_entries" }, |
|
796 | 735 | { :controller => 'timelog', :action => 'create', :issue_id => '234' } |
|
797 | 736 | ) |
|
798 | 737 | assert_routing( |
|
799 | 738 | { :method => 'put', :path => "/issues/234/time_entries/22" }, |
|
800 | 739 | { :controller => 'timelog', :action => 'update', :id => '22', |
|
801 | 740 | :issue_id => '234' } |
|
802 | 741 | ) |
|
803 | 742 | assert_routing( |
|
804 | 743 | { :method => 'delete', :path => "/issues/234/time_entries/55" }, |
|
805 | 744 | { :controller => 'timelog', :action => 'destroy', :id => '55', |
|
806 | 745 | :issue_id => '234' } |
|
807 | 746 | ) |
|
808 | 747 | end |
|
809 | 748 | |
|
810 | 749 | def test_timelogs_scoped_under_project_and_issues |
|
811 | 750 | assert_routing( |
|
812 | 751 | { :method => 'get', |
|
813 | 752 | :path => "/projects/ecookbook/issues/234/time_entries" }, |
|
814 | 753 | { :controller => 'timelog', :action => 'index', |
|
815 | 754 | :issue_id => '234', :project_id => 'ecookbook' } |
|
816 | 755 | ) |
|
817 | 756 | assert_routing( |
|
818 | 757 | { :method => 'get', |
|
819 | 758 | :path => "/projects/ecookbook/issues/234/time_entries.csv" }, |
|
820 | 759 | { :controller => 'timelog', :action => 'index', |
|
821 | 760 | :issue_id => '234', :project_id => 'ecookbook', :format => 'csv' } |
|
822 | 761 | ) |
|
823 | 762 | assert_routing( |
|
824 | 763 | { :method => 'get', |
|
825 | 764 | :path => "/projects/ecookbook/issues/234/time_entries.atom" }, |
|
826 | 765 | { :controller => 'timelog', :action => 'index', |
|
827 | 766 | :issue_id => '234', :project_id => 'ecookbook', :format => 'atom' } |
|
828 | 767 | ) |
|
829 | 768 | assert_routing( |
|
830 | 769 | { :method => 'get', |
|
831 | 770 | :path => "/projects/ecookbook/issues/234/time_entries/new" }, |
|
832 | 771 | { :controller => 'timelog', :action => 'new', |
|
833 | 772 | :issue_id => '234', :project_id => 'ecookbook' } |
|
834 | 773 | ) |
|
835 | 774 | assert_routing( |
|
836 | 775 | { :method => 'get', |
|
837 | 776 | :path => "/projects/ecookbook/issues/234/time_entries/22/edit" }, |
|
838 | 777 | { :controller => 'timelog', :action => 'edit', :id => '22', |
|
839 | 778 | :issue_id => '234', :project_id => 'ecookbook' } |
|
840 | 779 | ) |
|
841 | 780 | assert_routing( |
|
842 | 781 | { :method => 'post', |
|
843 | 782 | :path => "/projects/ecookbook/issues/234/time_entries" }, |
|
844 | 783 | { :controller => 'timelog', :action => 'create', |
|
845 | 784 | :issue_id => '234', :project_id => 'ecookbook' } |
|
846 | 785 | ) |
|
847 | 786 | assert_routing( |
|
848 | 787 | { :method => 'put', |
|
849 | 788 | :path => "/projects/ecookbook/issues/234/time_entries/22" }, |
|
850 | 789 | { :controller => 'timelog', :action => 'update', :id => '22', |
|
851 | 790 | :issue_id => '234', :project_id => 'ecookbook' } |
|
852 | 791 | ) |
|
853 | 792 | assert_routing( |
|
854 | 793 | { :method => 'delete', |
|
855 | 794 | :path => "/projects/ecookbook/issues/234/time_entries/55" }, |
|
856 | 795 | { :controller => 'timelog', :action => 'destroy', :id => '55', |
|
857 | 796 | :issue_id => '234', :project_id => 'ecookbook' } |
|
858 | 797 | ) |
|
859 | 798 | assert_routing( |
|
860 | 799 | { :method => 'get', |
|
861 | 800 | :path => "/time_entries/report" }, |
|
862 | 801 | { :controller => 'timelog', :action => 'report' } |
|
863 | 802 | ) |
|
864 | 803 | assert_routing( |
|
865 | 804 | { :method => 'get', |
|
866 | 805 | :path => "/projects/567/time_entries/report" }, |
|
867 | 806 | { :controller => 'timelog', :action => 'report', :project_id => '567' } |
|
868 | 807 | ) |
|
869 | 808 | assert_routing( |
|
870 | 809 | { :method => 'get', |
|
871 | 810 | :path => "/projects/567/time_entries/report.csv" }, |
|
872 | 811 | { :controller => 'timelog', :action => 'report', :project_id => '567', |
|
873 | 812 | :format => 'csv' } |
|
874 | 813 | ) |
|
875 | 814 | end |
|
876 | 815 | |
|
877 | 816 | def test_users |
|
878 | 817 | assert_routing( |
|
879 | 818 | { :method => 'get', :path => "/users" }, |
|
880 | 819 | { :controller => 'users', :action => 'index' } |
|
881 | 820 | ) |
|
882 | 821 | assert_routing( |
|
883 | 822 | { :method => 'get', :path => "/users.xml" }, |
|
884 | 823 | { :controller => 'users', :action => 'index', :format => 'xml' } |
|
885 | 824 | ) |
|
886 | 825 | assert_routing( |
|
887 | 826 | { :method => 'get', :path => "/users/44" }, |
|
888 | 827 | { :controller => 'users', :action => 'show', :id => '44' } |
|
889 | 828 | ) |
|
890 | 829 | assert_routing( |
|
891 | 830 | { :method => 'get', :path => "/users/44.xml" }, |
|
892 | 831 | { :controller => 'users', :action => 'show', :id => '44', |
|
893 | 832 | :format => 'xml' } |
|
894 | 833 | ) |
|
895 | 834 | assert_routing( |
|
896 | 835 | { :method => 'get', :path => "/users/current" }, |
|
897 | 836 | { :controller => 'users', :action => 'show', :id => 'current' } |
|
898 | 837 | ) |
|
899 | 838 | assert_routing( |
|
900 | 839 | { :method => 'get', :path => "/users/current.xml" }, |
|
901 | 840 | { :controller => 'users', :action => 'show', :id => 'current', |
|
902 | 841 | :format => 'xml' } |
|
903 | 842 | ) |
|
904 | 843 | assert_routing( |
|
905 | 844 | { :method => 'get', :path => "/users/new" }, |
|
906 | 845 | { :controller => 'users', :action => 'new' } |
|
907 | 846 | ) |
|
908 | 847 | assert_routing( |
|
909 | 848 | { :method => 'get', :path => "/users/444/edit" }, |
|
910 | 849 | { :controller => 'users', :action => 'edit', :id => '444' } |
|
911 | 850 | ) |
|
912 | 851 | assert_routing( |
|
913 | 852 | { :method => 'post', :path => "/users" }, |
|
914 | 853 | { :controller => 'users', :action => 'create' } |
|
915 | 854 | ) |
|
916 | 855 | assert_routing( |
|
917 | 856 | { :method => 'post', :path => "/users.xml" }, |
|
918 | 857 | { :controller => 'users', :action => 'create', :format => 'xml' } |
|
919 | 858 | ) |
|
920 | 859 | assert_routing( |
|
921 | 860 | { :method => 'put', :path => "/users/444" }, |
|
922 | 861 | { :controller => 'users', :action => 'update', :id => '444' } |
|
923 | 862 | ) |
|
924 | 863 | assert_routing( |
|
925 | 864 | { :method => 'put', :path => "/users/444.xml" }, |
|
926 | 865 | { :controller => 'users', :action => 'update', :id => '444', |
|
927 | 866 | :format => 'xml' } |
|
928 | 867 | ) |
|
929 | 868 | assert_routing( |
|
930 | 869 | { :method => 'delete', :path => "/users/44" }, |
|
931 | 870 | { :controller => 'users', :action => 'destroy', :id => '44' } |
|
932 | 871 | ) |
|
933 | 872 | assert_routing( |
|
934 | 873 | { :method => 'delete', :path => "/users/44.xml" }, |
|
935 | 874 | { :controller => 'users', :action => 'destroy', :id => '44', |
|
936 | 875 | :format => 'xml' } |
|
937 | 876 | ) |
|
938 | 877 | assert_routing( |
|
939 | 878 | { :method => 'post', :path => "/users/123/memberships" }, |
|
940 | 879 | { :controller => 'users', :action => 'edit_membership', |
|
941 | 880 | :id => '123' } |
|
942 | 881 | ) |
|
943 | 882 | assert_routing( |
|
944 | 883 | { :method => 'put', :path => "/users/123/memberships/55" }, |
|
945 | 884 | { :controller => 'users', :action => 'edit_membership', |
|
946 | 885 | :id => '123', :membership_id => '55' } |
|
947 | 886 | ) |
|
948 | 887 | assert_routing( |
|
949 | 888 | { :method => 'delete', :path => "/users/123/memberships/55" }, |
|
950 | 889 | { :controller => 'users', :action => 'destroy_membership', |
|
951 | 890 | :id => '123', :membership_id => '55' } |
|
952 | 891 | ) |
|
953 | 892 | end |
|
954 | 893 | |
|
955 | 894 | def test_versions |
|
956 | 895 | # /projects/foo/versions is /projects/foo/roadmap |
|
957 | 896 | assert_routing( |
|
958 | 897 | { :method => 'get', :path => "/projects/foo/versions.xml" }, |
|
959 | 898 | { :controller => 'versions', :action => 'index', |
|
960 | 899 | :project_id => 'foo', :format => 'xml' } |
|
961 | 900 | ) |
|
962 | 901 | assert_routing( |
|
963 | 902 | { :method => 'get', :path => "/projects/foo/versions.json" }, |
|
964 | 903 | { :controller => 'versions', :action => 'index', |
|
965 | 904 | :project_id => 'foo', :format => 'json' } |
|
966 | 905 | ) |
|
967 | 906 | assert_routing( |
|
968 | 907 | { :method => 'get', :path => "/projects/foo/versions/new" }, |
|
969 | 908 | { :controller => 'versions', :action => 'new', |
|
970 | 909 | :project_id => 'foo' } |
|
971 | 910 | ) |
|
972 | 911 | assert_routing( |
|
973 | 912 | { :method => 'post', :path => "/projects/foo/versions" }, |
|
974 | 913 | { :controller => 'versions', :action => 'create', |
|
975 | 914 | :project_id => 'foo' } |
|
976 | 915 | ) |
|
977 | 916 | assert_routing( |
|
978 | 917 | { :method => 'post', :path => "/projects/foo/versions.xml" }, |
|
979 | 918 | { :controller => 'versions', :action => 'create', |
|
980 | 919 | :project_id => 'foo', :format => 'xml' } |
|
981 | 920 | ) |
|
982 | 921 | assert_routing( |
|
983 | 922 | { :method => 'post', :path => "/projects/foo/versions.json" }, |
|
984 | 923 | { :controller => 'versions', :action => 'create', |
|
985 | 924 | :project_id => 'foo', :format => 'json' } |
|
986 | 925 | ) |
|
987 | 926 | assert_routing( |
|
988 | 927 | { :method => 'get', :path => "/versions/1" }, |
|
989 | 928 | { :controller => 'versions', :action => 'show', :id => '1' } |
|
990 | 929 | ) |
|
991 | 930 | assert_routing( |
|
992 | 931 | { :method => 'get', :path => "/versions/1.xml" }, |
|
993 | 932 | { :controller => 'versions', :action => 'show', :id => '1', |
|
994 | 933 | :format => 'xml' } |
|
995 | 934 | ) |
|
996 | 935 | assert_routing( |
|
997 | 936 | { :method => 'get', :path => "/versions/1.json" }, |
|
998 | 937 | { :controller => 'versions', :action => 'show', :id => '1', |
|
999 | 938 | :format => 'json' } |
|
1000 | 939 | ) |
|
1001 | 940 | assert_routing( |
|
1002 | 941 | { :method => 'get', :path => "/versions/1/edit" }, |
|
1003 | 942 | { :controller => 'versions', :action => 'edit', :id => '1' } |
|
1004 | 943 | ) |
|
1005 | 944 | assert_routing( |
|
1006 | 945 | { :method => 'put', :path => "/versions/1" }, |
|
1007 | 946 | { :controller => 'versions', :action => 'update', :id => '1' } |
|
1008 | 947 | ) |
|
1009 | 948 | assert_routing( |
|
1010 | 949 | { :method => 'put', :path => "/versions/1.xml" }, |
|
1011 | 950 | { :controller => 'versions', :action => 'update', :id => '1', |
|
1012 | 951 | :format => 'xml' } |
|
1013 | 952 | ) |
|
1014 | 953 | assert_routing( |
|
1015 | 954 | { :method => 'put', :path => "/versions/1.json" }, |
|
1016 | 955 | { :controller => 'versions', :action => 'update', :id => '1', |
|
1017 | 956 | :format => 'json' } |
|
1018 | 957 | ) |
|
1019 | 958 | assert_routing( |
|
1020 | 959 | { :method => 'delete', :path => "/versions/1" }, |
|
1021 | 960 | { :controller => 'versions', :action => 'destroy', :id => '1' } |
|
1022 | 961 | ) |
|
1023 | 962 | assert_routing( |
|
1024 | 963 | { :method => 'delete', :path => "/versions/1.xml" }, |
|
1025 | 964 | { :controller => 'versions', :action => 'destroy', :id => '1', |
|
1026 | 965 | :format => 'xml' } |
|
1027 | 966 | ) |
|
1028 | 967 | assert_routing( |
|
1029 | 968 | { :method => 'delete', :path => "/versions/1.json" }, |
|
1030 | 969 | { :controller => 'versions', :action => 'destroy', :id => '1', |
|
1031 | 970 | :format => 'json' } |
|
1032 | 971 | ) |
|
1033 | 972 | assert_routing( |
|
1034 | 973 | { :method => 'put', :path => "/projects/foo/versions/close_completed" }, |
|
1035 | 974 | { :controller => 'versions', :action => 'close_completed', |
|
1036 | 975 | :project_id => 'foo' } |
|
1037 | 976 | ) |
|
1038 | 977 | assert_routing( |
|
1039 | 978 | { :method => 'post', :path => "/versions/1/status_by" }, |
|
1040 | 979 | { :controller => 'versions', :action => 'status_by', :id => '1' } |
|
1041 | 980 | ) |
|
1042 | 981 | end |
|
1043 | 982 | |
|
1044 | 983 | def test_welcome |
|
1045 | 984 | assert_routing( |
|
1046 | 985 | { :method => 'get', :path => "/robots.txt" }, |
|
1047 | 986 | { :controller => 'welcome', :action => 'robots' } |
|
1048 | 987 | ) |
|
1049 | 988 | end |
|
1050 | 989 | |
|
1051 | 990 | def test_wiki_singular_projects_pages |
|
1052 | 991 | assert_routing( |
|
1053 | 992 | { :method => 'get', :path => "/projects/567/wiki" }, |
|
1054 | 993 | { :controller => 'wiki', :action => 'show', :project_id => '567' } |
|
1055 | 994 | ) |
|
1056 | 995 | assert_routing( |
|
1057 | 996 | { :method => 'get', :path => "/projects/567/wiki/lalala" }, |
|
1058 | 997 | { :controller => 'wiki', :action => 'show', :project_id => '567', |
|
1059 | 998 | :id => 'lalala' } |
|
1060 | 999 | ) |
|
1061 | 1000 | assert_routing( |
|
1062 | 1001 | { :method => 'get', :path => "/projects/567/wiki/my_page/edit" }, |
|
1063 | 1002 | { :controller => 'wiki', :action => 'edit', :project_id => '567', |
|
1064 | 1003 | :id => 'my_page' } |
|
1065 | 1004 | ) |
|
1066 | 1005 | assert_routing( |
|
1067 | 1006 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/history" }, |
|
1068 | 1007 | { :controller => 'wiki', :action => 'history', :project_id => '1', |
|
1069 | 1008 | :id => 'CookBook_documentation' } |
|
1070 | 1009 | ) |
|
1071 | 1010 | assert_routing( |
|
1072 | 1011 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff" }, |
|
1073 | 1012 | { :controller => 'wiki', :action => 'diff', :project_id => '1', |
|
1074 | 1013 | :id => 'CookBook_documentation' } |
|
1075 | 1014 | ) |
|
1076 | 1015 | assert_routing( |
|
1077 | 1016 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2" }, |
|
1078 | 1017 | { :controller => 'wiki', :action => 'diff', :project_id => '1', |
|
1079 | 1018 | :id => 'CookBook_documentation', :version => '2' } |
|
1080 | 1019 | ) |
|
1081 | 1020 | assert_routing( |
|
1082 | 1021 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2/vs/1" }, |
|
1083 | 1022 | { :controller => 'wiki', :action => 'diff', :project_id => '1', |
|
1084 | 1023 | :id => 'CookBook_documentation', :version => '2', :version_from => '1' } |
|
1085 | 1024 | ) |
|
1086 | 1025 | assert_routing( |
|
1087 | 1026 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/annotate/2" }, |
|
1088 | 1027 | { :controller => 'wiki', :action => 'annotate', :project_id => '1', |
|
1089 | 1028 | :id => 'CookBook_documentation', :version => '2' } |
|
1090 | 1029 | ) |
|
1091 | 1030 | assert_routing( |
|
1092 | 1031 | { :method => 'get', :path => "/projects/22/wiki/ladida/rename" }, |
|
1093 | 1032 | { :controller => 'wiki', :action => 'rename', :project_id => '22', |
|
1094 | 1033 | :id => 'ladida' } |
|
1095 | 1034 | ) |
|
1096 | 1035 | assert_routing( |
|
1097 | 1036 | { :method => 'get', :path => "/projects/567/wiki/index" }, |
|
1098 | 1037 | { :controller => 'wiki', :action => 'index', :project_id => '567' } |
|
1099 | 1038 | ) |
|
1100 | 1039 | assert_routing( |
|
1101 | 1040 | { :method => 'get', :path => "/projects/567/wiki/date_index" }, |
|
1102 | 1041 | { :controller => 'wiki', :action => 'date_index', :project_id => '567' } |
|
1103 | 1042 | ) |
|
1104 | 1043 | assert_routing( |
|
1105 | 1044 | { :method => 'get', :path => "/projects/567/wiki/export" }, |
|
1106 | 1045 | { :controller => 'wiki', :action => 'export', :project_id => '567' } |
|
1107 | 1046 | ) |
|
1108 | 1047 | assert_routing( |
|
1109 | 1048 | { :method => 'post', :path => "/projects/567/wiki/CookBook_documentation/preview" }, |
|
1110 | 1049 | { :controller => 'wiki', :action => 'preview', :project_id => '567', |
|
1111 | 1050 | :id => 'CookBook_documentation' } |
|
1112 | 1051 | ) |
|
1113 | 1052 | assert_routing( |
|
1114 | 1053 | { :method => 'post', :path => "/projects/22/wiki/ladida/rename" }, |
|
1115 | 1054 | { :controller => 'wiki', :action => 'rename', :project_id => '22', |
|
1116 | 1055 | :id => 'ladida' } |
|
1117 | 1056 | ) |
|
1118 | 1057 | assert_routing( |
|
1119 | 1058 | { :method => 'post', :path => "/projects/22/wiki/ladida/protect" }, |
|
1120 | 1059 | { :controller => 'wiki', :action => 'protect', :project_id => '22', |
|
1121 | 1060 | :id => 'ladida' } |
|
1122 | 1061 | ) |
|
1123 | 1062 | assert_routing( |
|
1124 | 1063 | { :method => 'post', :path => "/projects/22/wiki/ladida/add_attachment" }, |
|
1125 | 1064 | { :controller => 'wiki', :action => 'add_attachment', :project_id => '22', |
|
1126 | 1065 | :id => 'ladida' } |
|
1127 | 1066 | ) |
|
1128 | 1067 | assert_routing( |
|
1129 | 1068 | { :method => 'put', :path => "/projects/567/wiki/my_page" }, |
|
1130 | 1069 | { :controller => 'wiki', :action => 'update', :project_id => '567', |
|
1131 | 1070 | :id => 'my_page' } |
|
1132 | 1071 | ) |
|
1133 | 1072 | assert_routing( |
|
1134 | 1073 | { :method => 'delete', :path => "/projects/22/wiki/ladida" }, |
|
1135 | 1074 | { :controller => 'wiki', :action => 'destroy', :project_id => '22', |
|
1136 | 1075 | :id => 'ladida' } |
|
1137 | 1076 | ) |
|
1138 | 1077 | end |
|
1139 | 1078 | |
|
1140 | 1079 | def test_wikis_plural_admin_setup |
|
1141 | 1080 | assert_routing( |
|
1142 | 1081 | { :method => 'get', :path => "/projects/ladida/wiki/destroy" }, |
|
1143 | 1082 | { :controller => 'wikis', :action => 'destroy', :id => 'ladida' } |
|
1144 | 1083 | ) |
|
1145 | 1084 | assert_routing( |
|
1146 | 1085 | { :method => 'post', :path => "/projects/ladida/wiki" }, |
|
1147 | 1086 | { :controller => 'wikis', :action => 'edit', :id => 'ladida' } |
|
1148 | 1087 | ) |
|
1149 | 1088 | assert_routing( |
|
1150 | 1089 | { :method => 'post', :path => "/projects/ladida/wiki/destroy" }, |
|
1151 | 1090 | { :controller => 'wikis', :action => 'destroy', :id => 'ladida' } |
|
1152 | 1091 | ) |
|
1153 | 1092 | end |
|
1154 | 1093 | end |
General Comments 0
You need to be logged in to leave comments.
Login now