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