@@ -1,31 +1,35 | |||
|
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 RoutingPreviewsTest < ActionController::IntegrationTest |
|
21 | 21 | def test_previews |
|
22 | 22 | assert_routing( |
|
23 | 23 | { :method => 'get', :path => "/issues/preview/123" }, |
|
24 | 24 | { :controller => 'previews', :action => 'issue', :id => '123' } |
|
25 | 25 | ) |
|
26 | 26 | assert_routing( |
|
27 | 27 | { :method => 'post', :path => "/issues/preview/123" }, |
|
28 | 28 | { :controller => 'previews', :action => 'issue', :id => '123' } |
|
29 | 29 | ) |
|
30 | assert_routing( | |
|
31 | { :method => 'get', :path => "/news/preview" }, | |
|
32 | { :controller => 'previews', :action => 'news' } | |
|
33 | ) | |
|
30 | 34 | end |
|
31 | 35 | end |
@@ -1,513 +1,509 | |||
|
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/bulk_edit" }, |
|
119 | 119 | { :controller => 'issues', :action => 'bulk_edit' } |
|
120 | 120 | ) |
|
121 | 121 | assert_routing( |
|
122 | 122 | { :method => 'post', :path => "/issues/bulk_update" }, |
|
123 | 123 | { :controller => 'issues', :action => 'bulk_update' } |
|
124 | 124 | ) |
|
125 | 125 | end |
|
126 | 126 | |
|
127 | 127 | def test_issue_categories |
|
128 | 128 | assert_routing( |
|
129 | 129 | { :method => 'get', :path => "/projects/foo/issue_categories" }, |
|
130 | 130 | { :controller => 'issue_categories', :action => 'index', |
|
131 | 131 | :project_id => 'foo' } |
|
132 | 132 | ) |
|
133 | 133 | assert_routing( |
|
134 | 134 | { :method => 'get', :path => "/projects/foo/issue_categories.xml" }, |
|
135 | 135 | { :controller => 'issue_categories', :action => 'index', |
|
136 | 136 | :project_id => 'foo', :format => 'xml' } |
|
137 | 137 | ) |
|
138 | 138 | assert_routing( |
|
139 | 139 | { :method => 'get', :path => "/projects/foo/issue_categories.json" }, |
|
140 | 140 | { :controller => 'issue_categories', :action => 'index', |
|
141 | 141 | :project_id => 'foo', :format => 'json' } |
|
142 | 142 | ) |
|
143 | 143 | assert_routing( |
|
144 | 144 | { :method => 'get', :path => "/projects/foo/issue_categories/new" }, |
|
145 | 145 | { :controller => 'issue_categories', :action => 'new', |
|
146 | 146 | :project_id => 'foo' } |
|
147 | 147 | ) |
|
148 | 148 | assert_routing( |
|
149 | 149 | { :method => 'post', :path => "/projects/foo/issue_categories" }, |
|
150 | 150 | { :controller => 'issue_categories', :action => 'create', |
|
151 | 151 | :project_id => 'foo' } |
|
152 | 152 | ) |
|
153 | 153 | assert_routing( |
|
154 | 154 | { :method => 'post', :path => "/projects/foo/issue_categories.xml" }, |
|
155 | 155 | { :controller => 'issue_categories', :action => 'create', |
|
156 | 156 | :project_id => 'foo', :format => 'xml' } |
|
157 | 157 | ) |
|
158 | 158 | assert_routing( |
|
159 | 159 | { :method => 'post', :path => "/projects/foo/issue_categories.json" }, |
|
160 | 160 | { :controller => 'issue_categories', :action => 'create', |
|
161 | 161 | :project_id => 'foo', :format => 'json' } |
|
162 | 162 | ) |
|
163 | 163 | assert_routing( |
|
164 | 164 | { :method => 'get', :path => "/issue_categories/1" }, |
|
165 | 165 | { :controller => 'issue_categories', :action => 'show', :id => '1' } |
|
166 | 166 | ) |
|
167 | 167 | assert_routing( |
|
168 | 168 | { :method => 'get', :path => "/issue_categories/1.xml" }, |
|
169 | 169 | { :controller => 'issue_categories', :action => 'show', :id => '1', |
|
170 | 170 | :format => 'xml' } |
|
171 | 171 | ) |
|
172 | 172 | assert_routing( |
|
173 | 173 | { :method => 'get', :path => "/issue_categories/1.json" }, |
|
174 | 174 | { :controller => 'issue_categories', :action => 'show', :id => '1', |
|
175 | 175 | :format => 'json' } |
|
176 | 176 | ) |
|
177 | 177 | assert_routing( |
|
178 | 178 | { :method => 'get', :path => "/issue_categories/1/edit" }, |
|
179 | 179 | { :controller => 'issue_categories', :action => 'edit', :id => '1' } |
|
180 | 180 | ) |
|
181 | 181 | assert_routing( |
|
182 | 182 | { :method => 'put', :path => "/issue_categories/1" }, |
|
183 | 183 | { :controller => 'issue_categories', :action => 'update', :id => '1' } |
|
184 | 184 | ) |
|
185 | 185 | assert_routing( |
|
186 | 186 | { :method => 'put', :path => "/issue_categories/1.xml" }, |
|
187 | 187 | { :controller => 'issue_categories', :action => 'update', :id => '1', |
|
188 | 188 | :format => 'xml' } |
|
189 | 189 | ) |
|
190 | 190 | assert_routing( |
|
191 | 191 | { :method => 'put', :path => "/issue_categories/1.json" }, |
|
192 | 192 | { :controller => 'issue_categories', :action => 'update', :id => '1', |
|
193 | 193 | :format => 'json' } |
|
194 | 194 | ) |
|
195 | 195 | assert_routing( |
|
196 | 196 | { :method => 'delete', :path => "/issue_categories/1" }, |
|
197 | 197 | { :controller => 'issue_categories', :action => 'destroy', :id => '1' } |
|
198 | 198 | ) |
|
199 | 199 | assert_routing( |
|
200 | 200 | { :method => 'delete', :path => "/issue_categories/1.xml" }, |
|
201 | 201 | { :controller => 'issue_categories', :action => 'destroy', :id => '1', |
|
202 | 202 | :format => 'xml' } |
|
203 | 203 | ) |
|
204 | 204 | assert_routing( |
|
205 | 205 | { :method => 'delete', :path => "/issue_categories/1.json" }, |
|
206 | 206 | { :controller => 'issue_categories', :action => 'destroy', :id => '1', |
|
207 | 207 | :format => 'json' } |
|
208 | 208 | ) |
|
209 | 209 | end |
|
210 | 210 | |
|
211 | 211 | def test_news |
|
212 | 212 | assert_routing( |
|
213 | 213 | { :method => 'get', :path => "/news" }, |
|
214 | 214 | { :controller => 'news', :action => 'index' } |
|
215 | 215 | ) |
|
216 | 216 | assert_routing( |
|
217 | 217 | { :method => 'get', :path => "/news.atom" }, |
|
218 | 218 | { :controller => 'news', :action => 'index', :format => 'atom' } |
|
219 | 219 | ) |
|
220 | 220 | assert_routing( |
|
221 | 221 | { :method => 'get', :path => "/news.xml" }, |
|
222 | 222 | { :controller => 'news', :action => 'index', :format => 'xml' } |
|
223 | 223 | ) |
|
224 | 224 | assert_routing( |
|
225 | 225 | { :method => 'get', :path => "/news.json" }, |
|
226 | 226 | { :controller => 'news', :action => 'index', :format => 'json' } |
|
227 | 227 | ) |
|
228 | 228 | assert_routing( |
|
229 | 229 | { :method => 'get', :path => "/projects/567/news" }, |
|
230 | 230 | { :controller => 'news', :action => 'index', :project_id => '567' } |
|
231 | 231 | ) |
|
232 | 232 | assert_routing( |
|
233 | 233 | { :method => 'get', :path => "/projects/567/news.atom" }, |
|
234 | 234 | { :controller => 'news', :action => 'index', :format => 'atom', |
|
235 | 235 | :project_id => '567' } |
|
236 | 236 | ) |
|
237 | 237 | assert_routing( |
|
238 | 238 | { :method => 'get', :path => "/projects/567/news.xml" }, |
|
239 | 239 | { :controller => 'news', :action => 'index', :format => 'xml', |
|
240 | 240 | :project_id => '567' } |
|
241 | 241 | ) |
|
242 | 242 | assert_routing( |
|
243 | 243 | { :method => 'get', :path => "/projects/567/news.json" }, |
|
244 | 244 | { :controller => 'news', :action => 'index', :format => 'json', |
|
245 | 245 | :project_id => '567' } |
|
246 | 246 | ) |
|
247 | 247 | assert_routing( |
|
248 | 248 | { :method => 'get', :path => "/news/2" }, |
|
249 | 249 | { :controller => 'news', :action => 'show', :id => '2' } |
|
250 | 250 | ) |
|
251 | 251 | assert_routing( |
|
252 | 252 | { :method => 'get', :path => "/projects/567/news/new" }, |
|
253 | 253 | { :controller => 'news', :action => 'new', :project_id => '567' } |
|
254 | 254 | ) |
|
255 | 255 | assert_routing( |
|
256 | 256 | { :method => 'get', :path => "/news/234" }, |
|
257 | 257 | { :controller => 'news', :action => 'show', :id => '234' } |
|
258 | 258 | ) |
|
259 | 259 | assert_routing( |
|
260 | 260 | { :method => 'get', :path => "/news/567/edit" }, |
|
261 | 261 | { :controller => 'news', :action => 'edit', :id => '567' } |
|
262 | 262 | ) |
|
263 | 263 | assert_routing( |
|
264 | { :method => 'get', :path => "/news/preview" }, | |
|
265 | { :controller => 'previews', :action => 'news' } | |
|
266 | ) | |
|
267 | assert_routing( | |
|
268 | 264 | { :method => 'post', :path => "/projects/567/news" }, |
|
269 | 265 | { :controller => 'news', :action => 'create', :project_id => '567' } |
|
270 | 266 | ) |
|
271 | 267 | assert_routing( |
|
272 | 268 | { :method => 'post', :path => "/news/567/comments" }, |
|
273 | 269 | { :controller => 'comments', :action => 'create', :id => '567' } |
|
274 | 270 | ) |
|
275 | 271 | assert_routing( |
|
276 | 272 | { :method => 'put', :path => "/news/567" }, |
|
277 | 273 | { :controller => 'news', :action => 'update', :id => '567' } |
|
278 | 274 | ) |
|
279 | 275 | assert_routing( |
|
280 | 276 | { :method => 'delete', :path => "/news/567" }, |
|
281 | 277 | { :controller => 'news', :action => 'destroy', :id => '567' } |
|
282 | 278 | ) |
|
283 | 279 | assert_routing( |
|
284 | 280 | { :method => 'delete', :path => "/news/567/comments/15" }, |
|
285 | 281 | { :controller => 'comments', :action => 'destroy', :id => '567', |
|
286 | 282 | :comment_id => '15' } |
|
287 | 283 | ) |
|
288 | 284 | end |
|
289 | 285 | |
|
290 | 286 | def test_projects |
|
291 | 287 | assert_routing( |
|
292 | 288 | { :method => 'get', :path => "/projects" }, |
|
293 | 289 | { :controller => 'projects', :action => 'index' } |
|
294 | 290 | ) |
|
295 | 291 | assert_routing( |
|
296 | 292 | { :method => 'get', :path => "/projects.atom" }, |
|
297 | 293 | { :controller => 'projects', :action => 'index', :format => 'atom' } |
|
298 | 294 | ) |
|
299 | 295 | assert_routing( |
|
300 | 296 | { :method => 'get', :path => "/projects.xml" }, |
|
301 | 297 | { :controller => 'projects', :action => 'index', :format => 'xml' } |
|
302 | 298 | ) |
|
303 | 299 | assert_routing( |
|
304 | 300 | { :method => 'get', :path => "/projects/new" }, |
|
305 | 301 | { :controller => 'projects', :action => 'new' } |
|
306 | 302 | ) |
|
307 | 303 | assert_routing( |
|
308 | 304 | { :method => 'get', :path => "/projects/test" }, |
|
309 | 305 | { :controller => 'projects', :action => 'show', :id => 'test' } |
|
310 | 306 | ) |
|
311 | 307 | assert_routing( |
|
312 | 308 | { :method => 'get', :path => "/projects/1.xml" }, |
|
313 | 309 | { :controller => 'projects', :action => 'show', :id => '1', |
|
314 | 310 | :format => 'xml' } |
|
315 | 311 | ) |
|
316 | 312 | assert_routing( |
|
317 | 313 | { :method => 'get', :path => "/projects/4223/settings" }, |
|
318 | 314 | { :controller => 'projects', :action => 'settings', :id => '4223' } |
|
319 | 315 | ) |
|
320 | 316 | assert_routing( |
|
321 | 317 | { :method => 'get', :path => "/projects/4223/settings/members" }, |
|
322 | 318 | { :controller => 'projects', :action => 'settings', :id => '4223', |
|
323 | 319 | :tab => 'members' } |
|
324 | 320 | ) |
|
325 | 321 | assert_routing( |
|
326 | 322 | { :method => 'post', :path => "/projects" }, |
|
327 | 323 | { :controller => 'projects', :action => 'create' } |
|
328 | 324 | ) |
|
329 | 325 | assert_routing( |
|
330 | 326 | { :method => 'post', :path => "/projects.xml" }, |
|
331 | 327 | { :controller => 'projects', :action => 'create', :format => 'xml' } |
|
332 | 328 | ) |
|
333 | 329 | assert_routing( |
|
334 | 330 | { :method => 'post', :path => "/projects/64/archive" }, |
|
335 | 331 | { :controller => 'projects', :action => 'archive', :id => '64' } |
|
336 | 332 | ) |
|
337 | 333 | assert_routing( |
|
338 | 334 | { :method => 'post', :path => "/projects/64/unarchive" }, |
|
339 | 335 | { :controller => 'projects', :action => 'unarchive', :id => '64' } |
|
340 | 336 | ) |
|
341 | 337 | assert_routing( |
|
342 | 338 | { :method => 'put', :path => "/projects/64/enumerations" }, |
|
343 | 339 | { :controller => 'project_enumerations', :action => 'update', |
|
344 | 340 | :project_id => '64' } |
|
345 | 341 | ) |
|
346 | 342 | assert_routing( |
|
347 | 343 | { :method => 'put', :path => "/projects/4223" }, |
|
348 | 344 | { :controller => 'projects', :action => 'update', :id => '4223' } |
|
349 | 345 | ) |
|
350 | 346 | assert_routing( |
|
351 | 347 | { :method => 'put', :path => "/projects/1.xml" }, |
|
352 | 348 | { :controller => 'projects', :action => 'update', :id => '1', |
|
353 | 349 | :format => 'xml' } |
|
354 | 350 | ) |
|
355 | 351 | assert_routing( |
|
356 | 352 | { :method => 'delete', :path => "/projects/64" }, |
|
357 | 353 | { :controller => 'projects', :action => 'destroy', :id => '64' } |
|
358 | 354 | ) |
|
359 | 355 | assert_routing( |
|
360 | 356 | { :method => 'delete', :path => "/projects/1.xml" }, |
|
361 | 357 | { :controller => 'projects', :action => 'destroy', :id => '1', |
|
362 | 358 | :format => 'xml' } |
|
363 | 359 | ) |
|
364 | 360 | assert_routing( |
|
365 | 361 | { :method => 'delete', :path => "/projects/64/enumerations" }, |
|
366 | 362 | { :controller => 'project_enumerations', :action => 'destroy', |
|
367 | 363 | :project_id => '64' } |
|
368 | 364 | ) |
|
369 | 365 | end |
|
370 | 366 | |
|
371 | 367 | def test_queries |
|
372 | 368 | assert_routing( |
|
373 | 369 | { :method => 'get', :path => "/queries.xml" }, |
|
374 | 370 | { :controller => 'queries', :action => 'index', :format => 'xml' } |
|
375 | 371 | ) |
|
376 | 372 | assert_routing( |
|
377 | 373 | { :method => 'get', :path => "/queries.json" }, |
|
378 | 374 | { :controller => 'queries', :action => 'index', :format => 'json' } |
|
379 | 375 | ) |
|
380 | 376 | assert_routing( |
|
381 | 377 | { :method => 'get', :path => "/queries/new" }, |
|
382 | 378 | { :controller => 'queries', :action => 'new' } |
|
383 | 379 | ) |
|
384 | 380 | assert_routing( |
|
385 | 381 | { :method => 'get', :path => "/projects/redmine/queries/new" }, |
|
386 | 382 | { :controller => 'queries', :action => 'new', :project_id => 'redmine' } |
|
387 | 383 | ) |
|
388 | 384 | assert_routing( |
|
389 | 385 | { :method => 'post', :path => "/queries" }, |
|
390 | 386 | { :controller => 'queries', :action => 'create' } |
|
391 | 387 | ) |
|
392 | 388 | assert_routing( |
|
393 | 389 | { :method => 'post', :path => "/projects/redmine/queries" }, |
|
394 | 390 | { :controller => 'queries', :action => 'create', :project_id => 'redmine' } |
|
395 | 391 | ) |
|
396 | 392 | assert_routing( |
|
397 | 393 | { :method => 'get', :path => "/queries/1/edit" }, |
|
398 | 394 | { :controller => 'queries', :action => 'edit', :id => '1' } |
|
399 | 395 | ) |
|
400 | 396 | assert_routing( |
|
401 | 397 | { :method => 'put', :path => "/queries/1" }, |
|
402 | 398 | { :controller => 'queries', :action => 'update', :id => '1' } |
|
403 | 399 | ) |
|
404 | 400 | assert_routing( |
|
405 | 401 | { :method => 'delete', :path => "/queries/1" }, |
|
406 | 402 | { :controller => 'queries', :action => 'destroy', :id => '1' } |
|
407 | 403 | ) |
|
408 | 404 | end |
|
409 | 405 | |
|
410 | 406 | def test_wiki_singular_projects_pages |
|
411 | 407 | assert_routing( |
|
412 | 408 | { :method => 'get', :path => "/projects/567/wiki" }, |
|
413 | 409 | { :controller => 'wiki', :action => 'show', :project_id => '567' } |
|
414 | 410 | ) |
|
415 | 411 | assert_routing( |
|
416 | 412 | { :method => 'get', :path => "/projects/567/wiki/lalala" }, |
|
417 | 413 | { :controller => 'wiki', :action => 'show', :project_id => '567', |
|
418 | 414 | :id => 'lalala' } |
|
419 | 415 | ) |
|
420 | 416 | assert_routing( |
|
421 | 417 | { :method => 'get', :path => "/projects/567/wiki/my_page/edit" }, |
|
422 | 418 | { :controller => 'wiki', :action => 'edit', :project_id => '567', |
|
423 | 419 | :id => 'my_page' } |
|
424 | 420 | ) |
|
425 | 421 | assert_routing( |
|
426 | 422 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/history" }, |
|
427 | 423 | { :controller => 'wiki', :action => 'history', :project_id => '1', |
|
428 | 424 | :id => 'CookBook_documentation' } |
|
429 | 425 | ) |
|
430 | 426 | assert_routing( |
|
431 | 427 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff" }, |
|
432 | 428 | { :controller => 'wiki', :action => 'diff', :project_id => '1', |
|
433 | 429 | :id => 'CookBook_documentation' } |
|
434 | 430 | ) |
|
435 | 431 | assert_routing( |
|
436 | 432 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2" }, |
|
437 | 433 | { :controller => 'wiki', :action => 'diff', :project_id => '1', |
|
438 | 434 | :id => 'CookBook_documentation', :version => '2' } |
|
439 | 435 | ) |
|
440 | 436 | assert_routing( |
|
441 | 437 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2/vs/1" }, |
|
442 | 438 | { :controller => 'wiki', :action => 'diff', :project_id => '1', |
|
443 | 439 | :id => 'CookBook_documentation', :version => '2', :version_from => '1' } |
|
444 | 440 | ) |
|
445 | 441 | assert_routing( |
|
446 | 442 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/annotate/2" }, |
|
447 | 443 | { :controller => 'wiki', :action => 'annotate', :project_id => '1', |
|
448 | 444 | :id => 'CookBook_documentation', :version => '2' } |
|
449 | 445 | ) |
|
450 | 446 | assert_routing( |
|
451 | 447 | { :method => 'get', :path => "/projects/22/wiki/ladida/rename" }, |
|
452 | 448 | { :controller => 'wiki', :action => 'rename', :project_id => '22', |
|
453 | 449 | :id => 'ladida' } |
|
454 | 450 | ) |
|
455 | 451 | assert_routing( |
|
456 | 452 | { :method => 'get', :path => "/projects/567/wiki/index" }, |
|
457 | 453 | { :controller => 'wiki', :action => 'index', :project_id => '567' } |
|
458 | 454 | ) |
|
459 | 455 | assert_routing( |
|
460 | 456 | { :method => 'get', :path => "/projects/567/wiki/date_index" }, |
|
461 | 457 | { :controller => 'wiki', :action => 'date_index', :project_id => '567' } |
|
462 | 458 | ) |
|
463 | 459 | assert_routing( |
|
464 | 460 | { :method => 'get', :path => "/projects/567/wiki/export" }, |
|
465 | 461 | { :controller => 'wiki', :action => 'export', :project_id => '567' } |
|
466 | 462 | ) |
|
467 | 463 | assert_routing( |
|
468 | 464 | { :method => 'post', :path => "/projects/567/wiki/CookBook_documentation/preview" }, |
|
469 | 465 | { :controller => 'wiki', :action => 'preview', :project_id => '567', |
|
470 | 466 | :id => 'CookBook_documentation' } |
|
471 | 467 | ) |
|
472 | 468 | assert_routing( |
|
473 | 469 | { :method => 'post', :path => "/projects/22/wiki/ladida/rename" }, |
|
474 | 470 | { :controller => 'wiki', :action => 'rename', :project_id => '22', |
|
475 | 471 | :id => 'ladida' } |
|
476 | 472 | ) |
|
477 | 473 | assert_routing( |
|
478 | 474 | { :method => 'post', :path => "/projects/22/wiki/ladida/protect" }, |
|
479 | 475 | { :controller => 'wiki', :action => 'protect', :project_id => '22', |
|
480 | 476 | :id => 'ladida' } |
|
481 | 477 | ) |
|
482 | 478 | assert_routing( |
|
483 | 479 | { :method => 'post', :path => "/projects/22/wiki/ladida/add_attachment" }, |
|
484 | 480 | { :controller => 'wiki', :action => 'add_attachment', :project_id => '22', |
|
485 | 481 | :id => 'ladida' } |
|
486 | 482 | ) |
|
487 | 483 | assert_routing( |
|
488 | 484 | { :method => 'put', :path => "/projects/567/wiki/my_page" }, |
|
489 | 485 | { :controller => 'wiki', :action => 'update', :project_id => '567', |
|
490 | 486 | :id => 'my_page' } |
|
491 | 487 | ) |
|
492 | 488 | assert_routing( |
|
493 | 489 | { :method => 'delete', :path => "/projects/22/wiki/ladida" }, |
|
494 | 490 | { :controller => 'wiki', :action => 'destroy', :project_id => '22', |
|
495 | 491 | :id => 'ladida' } |
|
496 | 492 | ) |
|
497 | 493 | end |
|
498 | 494 | |
|
499 | 495 | def test_wikis_plural_admin_setup |
|
500 | 496 | assert_routing( |
|
501 | 497 | { :method => 'get', :path => "/projects/ladida/wiki/destroy" }, |
|
502 | 498 | { :controller => 'wikis', :action => 'destroy', :id => 'ladida' } |
|
503 | 499 | ) |
|
504 | 500 | assert_routing( |
|
505 | 501 | { :method => 'post', :path => "/projects/ladida/wiki" }, |
|
506 | 502 | { :controller => 'wikis', :action => 'edit', :id => 'ladida' } |
|
507 | 503 | ) |
|
508 | 504 | assert_routing( |
|
509 | 505 | { :method => 'post', :path => "/projects/ladida/wiki/destroy" }, |
|
510 | 506 | { :controller => 'wikis', :action => 'destroy', :id => 'ladida' } |
|
511 | 507 | ) |
|
512 | 508 | end |
|
513 | 509 | end |
General Comments 0
You need to be logged in to leave comments.
Login now