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