##// END OF EJS Templates
test: route: move repositories test to new file...
Toshi MARUYAMA -
r8220:c7d96d144119
parent child
Show More
@@ -0,0 +1,126
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 RoutingRepositoriesTest < ActionController::IntegrationTest
21 def test_repositories
22 assert_routing(
23 { :method => 'get',
24 :path => "/projects/redmine/repository" },
25 { :controller => 'repositories', :action => 'show', :id => 'redmine' }
26 )
27 assert_routing(
28 { :method => 'get',
29 :path => "/projects/redmine/repository/edit" },
30 { :controller => 'repositories', :action => 'edit', :id => 'redmine' }
31 )
32 assert_routing(
33 { :method => 'get',
34 :path => "/projects/redmine/repository/revisions" },
35 { :controller => 'repositories', :action => 'revisions', :id => 'redmine' }
36 )
37 assert_routing(
38 { :method => 'get',
39 :path => "/projects/redmine/repository/revisions.atom" },
40 { :controller => 'repositories', :action => 'revisions', :id => 'redmine',
41 :format => 'atom' }
42 )
43 assert_routing(
44 { :method => 'get',
45 :path => "/projects/redmine/repository/revisions/2457" },
46 { :controller => 'repositories', :action => 'revision', :id => 'redmine',
47 :rev => '2457' }
48 )
49 assert_routing(
50 { :method => 'get',
51 :path => "/projects/redmine/repository/revisions/2457/diff" },
52 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
53 :rev => '2457' }
54 )
55 assert_routing(
56 { :method => 'get',
57 :path => "/projects/redmine/repository/revisions/2457/diff.diff" },
58 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
59 :rev => '2457', :format => 'diff' }
60 )
61 assert_routing(
62 { :method => 'get',
63 :path => "/projects/redmine/repository/diff/path/to/file.c" },
64 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
65 :path => %w[path to file.c] }
66 )
67 assert_routing(
68 { :method => 'get',
69 :path => "/projects/redmine/repository/revisions/2/diff/path/to/file.c" },
70 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
71 :path => %w[path to file.c], :rev => '2' }
72 )
73 assert_routing(
74 { :method => 'get',
75 :path => "/projects/redmine/repository/browse/path/to/file.c" },
76 { :controller => 'repositories', :action => 'browse', :id => 'redmine',
77 :path => %w[path to file.c] }
78 )
79 assert_routing(
80 { :method => 'get',
81 :path => "/projects/redmine/repository/entry/path/to/file.c" },
82 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
83 :path => %w[path to file.c] }
84 )
85 assert_routing(
86 { :method => 'get',
87 :path => "/projects/redmine/repository/revisions/2/entry/path/to/file.c" },
88 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
89 :path => %w[path to file.c], :rev => '2' }
90 )
91 assert_routing(
92 { :method => 'get',
93 :path => "/projects/redmine/repository/raw/path/to/file.c" },
94 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
95 :path => %w[path to file.c], :format => 'raw' }
96 )
97 assert_routing(
98 { :method => 'get',
99 :path => "/projects/redmine/repository/revisions/2/raw/path/to/file.c" },
100 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
101 :path => %w[path to file.c], :rev => '2', :format => 'raw' }
102 )
103 assert_routing(
104 { :method => 'get',
105 :path => "/projects/redmine/repository/annotate/path/to/file.c" },
106 { :controller => 'repositories', :action => 'annotate', :id => 'redmine',
107 :path => %w[path to file.c] }
108 )
109 assert_routing(
110 { :method => 'get',
111 :path => "/projects/redmine/repository/changes/path/to/file.c" },
112 { :controller => 'repositories', :action => 'changes', :id => 'redmine',
113 :path => %w[path to file.c] }
114 )
115 assert_routing(
116 { :method => 'get',
117 :path => "/projects/redmine/repository/statistics" },
118 { :controller => 'repositories', :action => 'stats', :id => 'redmine' }
119 )
120 assert_routing(
121 { :method => 'post',
122 :path => "/projects/redmine/repository/edit" },
123 { :controller => 'repositories', :action => 'edit', :id => 'redmine' }
124 )
125 end
126 end
@@ -1,980 +1,874
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 249 def test_members
250 250 assert_routing(
251 251 { :method => 'post', :path => "/projects/5234/members/new" },
252 252 { :controller => 'members', :action => 'new', :id => '5234' }
253 253 )
254 254 end
255 255
256 256 def test_news
257 257 assert_routing(
258 258 { :method => 'get', :path => "/news" },
259 259 { :controller => 'news', :action => 'index' }
260 260 )
261 261 assert_routing(
262 262 { :method => 'get', :path => "/news.atom" },
263 263 { :controller => 'news', :action => 'index', :format => 'atom' }
264 264 )
265 265 assert_routing(
266 266 { :method => 'get', :path => "/news.xml" },
267 267 { :controller => 'news', :action => 'index', :format => 'xml' }
268 268 )
269 269 assert_routing(
270 270 { :method => 'get', :path => "/news.json" },
271 271 { :controller => 'news', :action => 'index', :format => 'json' }
272 272 )
273 273 assert_routing(
274 274 { :method => 'get', :path => "/projects/567/news" },
275 275 { :controller => 'news', :action => 'index', :project_id => '567' }
276 276 )
277 277 assert_routing(
278 278 { :method => 'get', :path => "/projects/567/news.atom" },
279 279 { :controller => 'news', :action => 'index', :format => 'atom',
280 280 :project_id => '567' }
281 281 )
282 282 assert_routing(
283 283 { :method => 'get', :path => "/projects/567/news.xml" },
284 284 { :controller => 'news', :action => 'index', :format => 'xml',
285 285 :project_id => '567' }
286 286 )
287 287 assert_routing(
288 288 { :method => 'get', :path => "/projects/567/news.json" },
289 289 { :controller => 'news', :action => 'index', :format => 'json',
290 290 :project_id => '567' }
291 291 )
292 292 assert_routing(
293 293 { :method => 'get', :path => "/news/2" },
294 294 { :controller => 'news', :action => 'show', :id => '2' }
295 295 )
296 296 assert_routing(
297 297 { :method => 'get', :path => "/projects/567/news/new" },
298 298 { :controller => 'news', :action => 'new', :project_id => '567' }
299 299 )
300 300 assert_routing(
301 301 { :method => 'get', :path => "/news/234" },
302 302 { :controller => 'news', :action => 'show', :id => '234' }
303 303 )
304 304 assert_routing(
305 305 { :method => 'get', :path => "/news/567/edit" },
306 306 { :controller => 'news', :action => 'edit', :id => '567' }
307 307 )
308 308 assert_routing(
309 309 { :method => 'get', :path => "/news/preview" },
310 310 { :controller => 'previews', :action => 'news' }
311 311 )
312 312 assert_routing(
313 313 { :method => 'post', :path => "/projects/567/news" },
314 314 { :controller => 'news', :action => 'create', :project_id => '567' }
315 315 )
316 316 assert_routing(
317 317 { :method => 'post', :path => "/news/567/comments" },
318 318 { :controller => 'comments', :action => 'create', :id => '567' }
319 319 )
320 320 assert_routing(
321 321 { :method => 'put', :path => "/news/567" },
322 322 { :controller => 'news', :action => 'update', :id => '567' }
323 323 )
324 324 assert_routing(
325 325 { :method => 'delete', :path => "/news/567" },
326 326 { :controller => 'news', :action => 'destroy', :id => '567' }
327 327 )
328 328 assert_routing(
329 329 { :method => 'delete', :path => "/news/567/comments/15" },
330 330 { :controller => 'comments', :action => 'destroy', :id => '567',
331 331 :comment_id => '15' }
332 332 )
333 333 end
334 334
335 335 def test_projects
336 336 assert_routing(
337 337 { :method => 'get', :path => "/projects" },
338 338 { :controller => 'projects', :action => 'index' }
339 339 )
340 340 assert_routing(
341 341 { :method => 'get', :path => "/projects.atom" },
342 342 { :controller => 'projects', :action => 'index', :format => 'atom' }
343 343 )
344 344 assert_routing(
345 345 { :method => 'get', :path => "/projects.xml" },
346 346 { :controller => 'projects', :action => 'index', :format => 'xml' }
347 347 )
348 348 assert_routing(
349 349 { :method => 'get', :path => "/projects/new" },
350 350 { :controller => 'projects', :action => 'new' }
351 351 )
352 352 assert_routing(
353 353 { :method => 'get', :path => "/projects/test" },
354 354 { :controller => 'projects', :action => 'show', :id => 'test' }
355 355 )
356 356 assert_routing(
357 357 { :method => 'get', :path => "/projects/1.xml" },
358 358 { :controller => 'projects', :action => 'show', :id => '1',
359 359 :format => 'xml' }
360 360 )
361 361 assert_routing(
362 362 { :method => 'get', :path => "/projects/4223/settings" },
363 363 { :controller => 'projects', :action => 'settings', :id => '4223' }
364 364 )
365 365 assert_routing(
366 366 { :method => 'get', :path => "/projects/4223/settings/members" },
367 367 { :controller => 'projects', :action => 'settings', :id => '4223',
368 368 :tab => 'members' }
369 369 )
370 370 assert_routing(
371 371 { :method => 'get', :path => "/projects/33/roadmap" },
372 372 { :controller => 'versions', :action => 'index', :project_id => '33' }
373 373 )
374 374 assert_routing(
375 375 { :method => 'get', :path => "/projects/33/activity" },
376 376 { :controller => 'activities', :action => 'index', :id => '33' }
377 377 )
378 378 assert_routing(
379 379 { :method => 'get', :path => "/projects/33/activity.atom" },
380 380 { :controller => 'activities', :action => 'index', :id => '33',
381 381 :format => 'atom' }
382 382 )
383 383 assert_routing(
384 384 { :method => 'post', :path => "/projects" },
385 385 { :controller => 'projects', :action => 'create' }
386 386 )
387 387 assert_routing(
388 388 { :method => 'post', :path => "/projects.xml" },
389 389 { :controller => 'projects', :action => 'create', :format => 'xml' }
390 390 )
391 391 assert_routing(
392 392 { :method => 'post', :path => "/projects/64/archive" },
393 393 { :controller => 'projects', :action => 'archive', :id => '64' }
394 394 )
395 395 assert_routing(
396 396 { :method => 'post', :path => "/projects/64/unarchive" },
397 397 { :controller => 'projects', :action => 'unarchive', :id => '64' }
398 398 )
399 399 assert_routing(
400 400 { :method => 'put', :path => "/projects/64/enumerations" },
401 401 { :controller => 'project_enumerations', :action => 'update',
402 402 :project_id => '64' }
403 403 )
404 404 assert_routing(
405 405 { :method => 'put', :path => "/projects/4223" },
406 406 { :controller => 'projects', :action => 'update', :id => '4223' }
407 407 )
408 408 assert_routing(
409 409 { :method => 'put', :path => "/projects/1.xml" },
410 410 { :controller => 'projects', :action => 'update', :id => '1',
411 411 :format => 'xml' }
412 412 )
413 413 assert_routing(
414 414 { :method => 'delete', :path => "/projects/64" },
415 415 { :controller => 'projects', :action => 'destroy', :id => '64' }
416 416 )
417 417 assert_routing(
418 418 { :method => 'delete', :path => "/projects/1.xml" },
419 419 { :controller => 'projects', :action => 'destroy', :id => '1',
420 420 :format => 'xml' }
421 421 )
422 422 assert_routing(
423 423 { :method => 'delete', :path => "/projects/64/enumerations" },
424 424 { :controller => 'project_enumerations', :action => 'destroy',
425 425 :project_id => '64' }
426 426 )
427 427 end
428 428
429 429 def test_queries
430 430 assert_routing(
431 431 { :method => 'get', :path => "/queries.xml" },
432 432 { :controller => 'queries', :action => 'index', :format => 'xml' }
433 433 )
434 434 assert_routing(
435 435 { :method => 'get', :path => "/queries.json" },
436 436 { :controller => 'queries', :action => 'index', :format => 'json' }
437 437 )
438 438 assert_routing(
439 439 { :method => 'get', :path => "/queries/new" },
440 440 { :controller => 'queries', :action => 'new' }
441 441 )
442 442 assert_routing(
443 443 { :method => 'get', :path => "/projects/redmine/queries/new" },
444 444 { :controller => 'queries', :action => 'new', :project_id => 'redmine' }
445 445 )
446 446 assert_routing(
447 447 { :method => 'post', :path => "/queries" },
448 448 { :controller => 'queries', :action => 'create' }
449 449 )
450 450 assert_routing(
451 451 { :method => 'post', :path => "/projects/redmine/queries" },
452 452 { :controller => 'queries', :action => 'create', :project_id => 'redmine' }
453 453 )
454 454 assert_routing(
455 455 { :method => 'get', :path => "/queries/1/edit" },
456 456 { :controller => 'queries', :action => 'edit', :id => '1' }
457 457 )
458 458 assert_routing(
459 459 { :method => 'put', :path => "/queries/1" },
460 460 { :controller => 'queries', :action => 'update', :id => '1' }
461 461 )
462 462 assert_routing(
463 463 { :method => 'delete', :path => "/queries/1" },
464 464 { :controller => 'queries', :action => 'destroy', :id => '1' }
465 465 )
466 466 end
467 467
468 def test_repositories
469 assert_routing(
470 { :method => 'get',
471 :path => "/projects/redmine/repository" },
472 { :controller => 'repositories', :action => 'show', :id => 'redmine' }
473 )
474 assert_routing(
475 { :method => 'get',
476 :path => "/projects/redmine/repository/edit" },
477 { :controller => 'repositories', :action => 'edit', :id => 'redmine' }
478 )
479 assert_routing(
480 { :method => 'get',
481 :path => "/projects/redmine/repository/revisions" },
482 { :controller => 'repositories', :action => 'revisions', :id => 'redmine' }
483 )
484 assert_routing(
485 { :method => 'get',
486 :path => "/projects/redmine/repository/revisions.atom" },
487 { :controller => 'repositories', :action => 'revisions', :id => 'redmine',
488 :format => 'atom' }
489 )
490 assert_routing(
491 { :method => 'get',
492 :path => "/projects/redmine/repository/revisions/2457" },
493 { :controller => 'repositories', :action => 'revision', :id => 'redmine',
494 :rev => '2457' }
495 )
496 assert_routing(
497 { :method => 'get',
498 :path => "/projects/redmine/repository/revisions/2457/diff" },
499 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
500 :rev => '2457' }
501 )
502 assert_routing(
503 { :method => 'get',
504 :path => "/projects/redmine/repository/revisions/2457/diff.diff" },
505 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
506 :rev => '2457', :format => 'diff' }
507 )
508 assert_routing(
509 { :method => 'get',
510 :path => "/projects/redmine/repository/diff/path/to/file.c" },
511 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
512 :path => %w[path to file.c] }
513 )
514 assert_routing(
515 { :method => 'get',
516 :path => "/projects/redmine/repository/revisions/2/diff/path/to/file.c" },
517 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
518 :path => %w[path to file.c], :rev => '2' }
519 )
520 assert_routing(
521 { :method => 'get',
522 :path => "/projects/redmine/repository/browse/path/to/file.c" },
523 { :controller => 'repositories', :action => 'browse', :id => 'redmine',
524 :path => %w[path to file.c] }
525 )
526 assert_routing(
527 { :method => 'get',
528 :path => "/projects/redmine/repository/entry/path/to/file.c" },
529 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
530 :path => %w[path to file.c] }
531 )
532 assert_routing(
533 { :method => 'get',
534 :path => "/projects/redmine/repository/revisions/2/entry/path/to/file.c" },
535 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
536 :path => %w[path to file.c], :rev => '2' }
537 )
538 assert_routing(
539 { :method => 'get',
540 :path => "/projects/redmine/repository/raw/path/to/file.c" },
541 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
542 :path => %w[path to file.c], :format => 'raw' }
543 )
544 assert_routing(
545 { :method => 'get',
546 :path => "/projects/redmine/repository/revisions/2/raw/path/to/file.c" },
547 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
548 :path => %w[path to file.c], :rev => '2', :format => 'raw' }
549 )
550 assert_routing(
551 { :method => 'get',
552 :path => "/projects/redmine/repository/annotate/path/to/file.c" },
553 { :controller => 'repositories', :action => 'annotate', :id => 'redmine',
554 :path => %w[path to file.c] }
555 )
556 assert_routing(
557 { :method => 'get',
558 :path => "/projects/redmine/repository/changes/path/to/file.c" },
559 { :controller => 'repositories', :action => 'changes', :id => 'redmine',
560 :path => %w[path to file.c] }
561 )
562 assert_routing(
563 { :method => 'get',
564 :path => "/projects/redmine/repository/statistics" },
565 { :controller => 'repositories', :action => 'stats', :id => 'redmine' }
566 )
567 assert_routing(
568 { :method => 'post',
569 :path => "/projects/redmine/repository/edit" },
570 { :controller => 'repositories', :action => 'edit', :id => 'redmine' }
571 )
572 end
573
574 468 def test_roles
575 469 assert_routing(
576 470 { :method => 'get', :path => "/roles" },
577 471 { :controller => 'roles', :action => 'index' }
578 472 )
579 473 assert_routing(
580 474 { :method => 'get', :path => "/roles/new" },
581 475 { :controller => 'roles', :action => 'new' }
582 476 )
583 477 assert_routing(
584 478 { :method => 'post', :path => "/roles" },
585 479 { :controller => 'roles', :action => 'create' }
586 480 )
587 481 assert_routing(
588 482 { :method => 'get', :path => "/roles/2/edit" },
589 483 { :controller => 'roles', :action => 'edit', :id => '2' }
590 484 )
591 485 assert_routing(
592 486 { :method => 'put', :path => "/roles/2" },
593 487 { :controller => 'roles', :action => 'update', :id => '2' }
594 488 )
595 489 assert_routing(
596 490 { :method => 'delete', :path => "/roles/2" },
597 491 { :controller => 'roles', :action => 'destroy', :id => '2' }
598 492 )
599 493 assert_routing(
600 494 { :method => 'get', :path => "/roles/permissions" },
601 495 { :controller => 'roles', :action => 'permissions' }
602 496 )
603 497 assert_routing(
604 498 { :method => 'post', :path => "/roles/permissions" },
605 499 { :controller => 'roles', :action => 'permissions' }
606 500 )
607 501 end
608 502
609 503 def test_timelogs_global
610 504 assert_routing(
611 505 { :method => 'get', :path => "/time_entries" },
612 506 { :controller => 'timelog', :action => 'index' }
613 507 )
614 508 assert_routing(
615 509 { :method => 'get', :path => "/time_entries.csv" },
616 510 { :controller => 'timelog', :action => 'index', :format => 'csv' }
617 511 )
618 512 assert_routing(
619 513 { :method => 'get', :path => "/time_entries.atom" },
620 514 { :controller => 'timelog', :action => 'index', :format => 'atom' }
621 515 )
622 516 assert_routing(
623 517 { :method => 'get', :path => "/time_entries/new" },
624 518 { :controller => 'timelog', :action => 'new' }
625 519 )
626 520 assert_routing(
627 521 { :method => 'get', :path => "/time_entries/22/edit" },
628 522 { :controller => 'timelog', :action => 'edit', :id => '22' }
629 523 )
630 524 assert_routing(
631 525 { :method => 'post', :path => "/time_entries" },
632 526 { :controller => 'timelog', :action => 'create' }
633 527 )
634 528 assert_routing(
635 529 { :method => 'put', :path => "/time_entries/22" },
636 530 { :controller => 'timelog', :action => 'update', :id => '22' }
637 531 )
638 532 assert_routing(
639 533 { :method => 'delete', :path => "/time_entries/55" },
640 534 { :controller => 'timelog', :action => 'destroy', :id => '55' }
641 535 )
642 536 end
643 537
644 538 def test_timelogs_scoped_under_project
645 539 assert_routing(
646 540 { :method => 'get', :path => "/projects/567/time_entries" },
647 541 { :controller => 'timelog', :action => 'index', :project_id => '567' }
648 542 )
649 543 assert_routing(
650 544 { :method => 'get', :path => "/projects/567/time_entries.csv" },
651 545 { :controller => 'timelog', :action => 'index', :project_id => '567',
652 546 :format => 'csv' }
653 547 )
654 548 assert_routing(
655 549 { :method => 'get', :path => "/projects/567/time_entries.atom" },
656 550 { :controller => 'timelog', :action => 'index', :project_id => '567',
657 551 :format => 'atom' }
658 552 )
659 553 assert_routing(
660 554 { :method => 'get', :path => "/projects/567/time_entries/new" },
661 555 { :controller => 'timelog', :action => 'new', :project_id => '567' }
662 556 )
663 557 assert_routing(
664 558 { :method => 'get', :path => "/projects/567/time_entries/22/edit" },
665 559 { :controller => 'timelog', :action => 'edit',
666 560 :id => '22', :project_id => '567' }
667 561 )
668 562 assert_routing(
669 563 { :method => 'post', :path => "/projects/567/time_entries" },
670 564 { :controller => 'timelog', :action => 'create',
671 565 :project_id => '567' }
672 566 )
673 567 assert_routing(
674 568 { :method => 'put', :path => "/projects/567/time_entries/22" },
675 569 { :controller => 'timelog', :action => 'update',
676 570 :id => '22', :project_id => '567' }
677 571 )
678 572 assert_routing(
679 573 { :method => 'delete', :path => "/projects/567/time_entries/55" },
680 574 { :controller => 'timelog', :action => 'destroy',
681 575 :id => '55', :project_id => '567' }
682 576 )
683 577 end
684 578
685 579 def test_timelogs_scoped_under_issues
686 580 assert_routing(
687 581 { :method => 'get', :path => "/issues/234/time_entries" },
688 582 { :controller => 'timelog', :action => 'index', :issue_id => '234' }
689 583 )
690 584 assert_routing(
691 585 { :method => 'get', :path => "/issues/234/time_entries.csv" },
692 586 { :controller => 'timelog', :action => 'index', :issue_id => '234',
693 587 :format => 'csv' }
694 588 )
695 589 assert_routing(
696 590 { :method => 'get', :path => "/issues/234/time_entries.atom" },
697 591 { :controller => 'timelog', :action => 'index', :issue_id => '234',
698 592 :format => 'atom' }
699 593 )
700 594 assert_routing(
701 595 { :method => 'get', :path => "/issues/234/time_entries/new" },
702 596 { :controller => 'timelog', :action => 'new', :issue_id => '234' }
703 597 )
704 598 assert_routing(
705 599 { :method => 'get', :path => "/issues/234/time_entries/22/edit" },
706 600 { :controller => 'timelog', :action => 'edit', :id => '22',
707 601 :issue_id => '234' }
708 602 )
709 603 assert_routing(
710 604 { :method => 'post', :path => "/issues/234/time_entries" },
711 605 { :controller => 'timelog', :action => 'create', :issue_id => '234' }
712 606 )
713 607 assert_routing(
714 608 { :method => 'put', :path => "/issues/234/time_entries/22" },
715 609 { :controller => 'timelog', :action => 'update', :id => '22',
716 610 :issue_id => '234' }
717 611 )
718 612 assert_routing(
719 613 { :method => 'delete', :path => "/issues/234/time_entries/55" },
720 614 { :controller => 'timelog', :action => 'destroy', :id => '55',
721 615 :issue_id => '234' }
722 616 )
723 617 end
724 618
725 619 def test_timelogs_scoped_under_project_and_issues
726 620 assert_routing(
727 621 { :method => 'get',
728 622 :path => "/projects/ecookbook/issues/234/time_entries" },
729 623 { :controller => 'timelog', :action => 'index',
730 624 :issue_id => '234', :project_id => 'ecookbook' }
731 625 )
732 626 assert_routing(
733 627 { :method => 'get',
734 628 :path => "/projects/ecookbook/issues/234/time_entries.csv" },
735 629 { :controller => 'timelog', :action => 'index',
736 630 :issue_id => '234', :project_id => 'ecookbook', :format => 'csv' }
737 631 )
738 632 assert_routing(
739 633 { :method => 'get',
740 634 :path => "/projects/ecookbook/issues/234/time_entries.atom" },
741 635 { :controller => 'timelog', :action => 'index',
742 636 :issue_id => '234', :project_id => 'ecookbook', :format => 'atom' }
743 637 )
744 638 assert_routing(
745 639 { :method => 'get',
746 640 :path => "/projects/ecookbook/issues/234/time_entries/new" },
747 641 { :controller => 'timelog', :action => 'new',
748 642 :issue_id => '234', :project_id => 'ecookbook' }
749 643 )
750 644 assert_routing(
751 645 { :method => 'get',
752 646 :path => "/projects/ecookbook/issues/234/time_entries/22/edit" },
753 647 { :controller => 'timelog', :action => 'edit', :id => '22',
754 648 :issue_id => '234', :project_id => 'ecookbook' }
755 649 )
756 650 assert_routing(
757 651 { :method => 'post',
758 652 :path => "/projects/ecookbook/issues/234/time_entries" },
759 653 { :controller => 'timelog', :action => 'create',
760 654 :issue_id => '234', :project_id => 'ecookbook' }
761 655 )
762 656 assert_routing(
763 657 { :method => 'put',
764 658 :path => "/projects/ecookbook/issues/234/time_entries/22" },
765 659 { :controller => 'timelog', :action => 'update', :id => '22',
766 660 :issue_id => '234', :project_id => 'ecookbook' }
767 661 )
768 662 assert_routing(
769 663 { :method => 'delete',
770 664 :path => "/projects/ecookbook/issues/234/time_entries/55" },
771 665 { :controller => 'timelog', :action => 'destroy', :id => '55',
772 666 :issue_id => '234', :project_id => 'ecookbook' }
773 667 )
774 668 assert_routing(
775 669 { :method => 'get',
776 670 :path => "/time_entries/report" },
777 671 { :controller => 'timelog', :action => 'report' }
778 672 )
779 673 assert_routing(
780 674 { :method => 'get',
781 675 :path => "/projects/567/time_entries/report" },
782 676 { :controller => 'timelog', :action => 'report', :project_id => '567' }
783 677 )
784 678 assert_routing(
785 679 { :method => 'get',
786 680 :path => "/projects/567/time_entries/report.csv" },
787 681 { :controller => 'timelog', :action => 'report', :project_id => '567',
788 682 :format => 'csv' }
789 683 )
790 684 end
791 685
792 686 def test_users
793 687 assert_routing(
794 688 { :method => 'get', :path => "/users" },
795 689 { :controller => 'users', :action => 'index' }
796 690 )
797 691 assert_routing(
798 692 { :method => 'get', :path => "/users.xml" },
799 693 { :controller => 'users', :action => 'index', :format => 'xml' }
800 694 )
801 695 assert_routing(
802 696 { :method => 'get', :path => "/users/44" },
803 697 { :controller => 'users', :action => 'show', :id => '44' }
804 698 )
805 699 assert_routing(
806 700 { :method => 'get', :path => "/users/44.xml" },
807 701 { :controller => 'users', :action => 'show', :id => '44',
808 702 :format => 'xml' }
809 703 )
810 704 assert_routing(
811 705 { :method => 'get', :path => "/users/current" },
812 706 { :controller => 'users', :action => 'show', :id => 'current' }
813 707 )
814 708 assert_routing(
815 709 { :method => 'get', :path => "/users/current.xml" },
816 710 { :controller => 'users', :action => 'show', :id => 'current',
817 711 :format => 'xml' }
818 712 )
819 713 assert_routing(
820 714 { :method => 'get', :path => "/users/new" },
821 715 { :controller => 'users', :action => 'new' }
822 716 )
823 717 assert_routing(
824 718 { :method => 'get', :path => "/users/444/edit" },
825 719 { :controller => 'users', :action => 'edit', :id => '444' }
826 720 )
827 721 assert_routing(
828 722 { :method => 'post', :path => "/users" },
829 723 { :controller => 'users', :action => 'create' }
830 724 )
831 725 assert_routing(
832 726 { :method => 'post', :path => "/users.xml" },
833 727 { :controller => 'users', :action => 'create', :format => 'xml' }
834 728 )
835 729 assert_routing(
836 730 { :method => 'put', :path => "/users/444" },
837 731 { :controller => 'users', :action => 'update', :id => '444' }
838 732 )
839 733 assert_routing(
840 734 { :method => 'put', :path => "/users/444.xml" },
841 735 { :controller => 'users', :action => 'update', :id => '444',
842 736 :format => 'xml' }
843 737 )
844 738 assert_routing(
845 739 { :method => 'delete', :path => "/users/44" },
846 740 { :controller => 'users', :action => 'destroy', :id => '44' }
847 741 )
848 742 assert_routing(
849 743 { :method => 'delete', :path => "/users/44.xml" },
850 744 { :controller => 'users', :action => 'destroy', :id => '44',
851 745 :format => 'xml' }
852 746 )
853 747 assert_routing(
854 748 { :method => 'post', :path => "/users/123/memberships" },
855 749 { :controller => 'users', :action => 'edit_membership',
856 750 :id => '123' }
857 751 )
858 752 assert_routing(
859 753 { :method => 'put', :path => "/users/123/memberships/55" },
860 754 { :controller => 'users', :action => 'edit_membership',
861 755 :id => '123', :membership_id => '55' }
862 756 )
863 757 assert_routing(
864 758 { :method => 'delete', :path => "/users/123/memberships/55" },
865 759 { :controller => 'users', :action => 'destroy_membership',
866 760 :id => '123', :membership_id => '55' }
867 761 )
868 762 end
869 763
870 764 def test_welcome
871 765 assert_routing(
872 766 { :method => 'get', :path => "/robots.txt" },
873 767 { :controller => 'welcome', :action => 'robots' }
874 768 )
875 769 end
876 770
877 771 def test_wiki_singular_projects_pages
878 772 assert_routing(
879 773 { :method => 'get', :path => "/projects/567/wiki" },
880 774 { :controller => 'wiki', :action => 'show', :project_id => '567' }
881 775 )
882 776 assert_routing(
883 777 { :method => 'get', :path => "/projects/567/wiki/lalala" },
884 778 { :controller => 'wiki', :action => 'show', :project_id => '567',
885 779 :id => 'lalala' }
886 780 )
887 781 assert_routing(
888 782 { :method => 'get', :path => "/projects/567/wiki/my_page/edit" },
889 783 { :controller => 'wiki', :action => 'edit', :project_id => '567',
890 784 :id => 'my_page' }
891 785 )
892 786 assert_routing(
893 787 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/history" },
894 788 { :controller => 'wiki', :action => 'history', :project_id => '1',
895 789 :id => 'CookBook_documentation' }
896 790 )
897 791 assert_routing(
898 792 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff" },
899 793 { :controller => 'wiki', :action => 'diff', :project_id => '1',
900 794 :id => 'CookBook_documentation' }
901 795 )
902 796 assert_routing(
903 797 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2" },
904 798 { :controller => 'wiki', :action => 'diff', :project_id => '1',
905 799 :id => 'CookBook_documentation', :version => '2' }
906 800 )
907 801 assert_routing(
908 802 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2/vs/1" },
909 803 { :controller => 'wiki', :action => 'diff', :project_id => '1',
910 804 :id => 'CookBook_documentation', :version => '2', :version_from => '1' }
911 805 )
912 806 assert_routing(
913 807 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/annotate/2" },
914 808 { :controller => 'wiki', :action => 'annotate', :project_id => '1',
915 809 :id => 'CookBook_documentation', :version => '2' }
916 810 )
917 811 assert_routing(
918 812 { :method => 'get', :path => "/projects/22/wiki/ladida/rename" },
919 813 { :controller => 'wiki', :action => 'rename', :project_id => '22',
920 814 :id => 'ladida' }
921 815 )
922 816 assert_routing(
923 817 { :method => 'get', :path => "/projects/567/wiki/index" },
924 818 { :controller => 'wiki', :action => 'index', :project_id => '567' }
925 819 )
926 820 assert_routing(
927 821 { :method => 'get', :path => "/projects/567/wiki/date_index" },
928 822 { :controller => 'wiki', :action => 'date_index', :project_id => '567' }
929 823 )
930 824 assert_routing(
931 825 { :method => 'get', :path => "/projects/567/wiki/export" },
932 826 { :controller => 'wiki', :action => 'export', :project_id => '567' }
933 827 )
934 828 assert_routing(
935 829 { :method => 'post', :path => "/projects/567/wiki/CookBook_documentation/preview" },
936 830 { :controller => 'wiki', :action => 'preview', :project_id => '567',
937 831 :id => 'CookBook_documentation' }
938 832 )
939 833 assert_routing(
940 834 { :method => 'post', :path => "/projects/22/wiki/ladida/rename" },
941 835 { :controller => 'wiki', :action => 'rename', :project_id => '22',
942 836 :id => 'ladida' }
943 837 )
944 838 assert_routing(
945 839 { :method => 'post', :path => "/projects/22/wiki/ladida/protect" },
946 840 { :controller => 'wiki', :action => 'protect', :project_id => '22',
947 841 :id => 'ladida' }
948 842 )
949 843 assert_routing(
950 844 { :method => 'post', :path => "/projects/22/wiki/ladida/add_attachment" },
951 845 { :controller => 'wiki', :action => 'add_attachment', :project_id => '22',
952 846 :id => 'ladida' }
953 847 )
954 848 assert_routing(
955 849 { :method => 'put', :path => "/projects/567/wiki/my_page" },
956 850 { :controller => 'wiki', :action => 'update', :project_id => '567',
957 851 :id => 'my_page' }
958 852 )
959 853 assert_routing(
960 854 { :method => 'delete', :path => "/projects/22/wiki/ladida" },
961 855 { :controller => 'wiki', :action => 'destroy', :project_id => '22',
962 856 :id => 'ladida' }
963 857 )
964 858 end
965 859
966 860 def test_wikis_plural_admin_setup
967 861 assert_routing(
968 862 { :method => 'get', :path => "/projects/ladida/wiki/destroy" },
969 863 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
970 864 )
971 865 assert_routing(
972 866 { :method => 'post', :path => "/projects/ladida/wiki" },
973 867 { :controller => 'wikis', :action => 'edit', :id => 'ladida' }
974 868 )
975 869 assert_routing(
976 870 { :method => 'post', :path => "/projects/ladida/wiki/destroy" },
977 871 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
978 872 )
979 873 end
980 874 end
General Comments 0
You need to be logged in to leave comments. Login now