##// END OF EJS Templates
test: route: move timelogs tests to new file...
Toshi MARUYAMA -
r8223:bc7ed1e15678
parent child
Show More
@@ -0,0 +1,203
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 RoutingTimelogsTest < ActionController::IntegrationTest
21 def test_timelogs_global
22 assert_routing(
23 { :method => 'get', :path => "/time_entries" },
24 { :controller => 'timelog', :action => 'index' }
25 )
26 assert_routing(
27 { :method => 'get', :path => "/time_entries.csv" },
28 { :controller => 'timelog', :action => 'index', :format => 'csv' }
29 )
30 assert_routing(
31 { :method => 'get', :path => "/time_entries.atom" },
32 { :controller => 'timelog', :action => 'index', :format => 'atom' }
33 )
34 assert_routing(
35 { :method => 'get', :path => "/time_entries/new" },
36 { :controller => 'timelog', :action => 'new' }
37 )
38 assert_routing(
39 { :method => 'get', :path => "/time_entries/22/edit" },
40 { :controller => 'timelog', :action => 'edit', :id => '22' }
41 )
42 assert_routing(
43 { :method => 'post', :path => "/time_entries" },
44 { :controller => 'timelog', :action => 'create' }
45 )
46 assert_routing(
47 { :method => 'put', :path => "/time_entries/22" },
48 { :controller => 'timelog', :action => 'update', :id => '22' }
49 )
50 assert_routing(
51 { :method => 'delete', :path => "/time_entries/55" },
52 { :controller => 'timelog', :action => 'destroy', :id => '55' }
53 )
54 end
55
56 def test_timelogs_scoped_under_project
57 assert_routing(
58 { :method => 'get', :path => "/projects/567/time_entries" },
59 { :controller => 'timelog', :action => 'index', :project_id => '567' }
60 )
61 assert_routing(
62 { :method => 'get', :path => "/projects/567/time_entries.csv" },
63 { :controller => 'timelog', :action => 'index', :project_id => '567',
64 :format => 'csv' }
65 )
66 assert_routing(
67 { :method => 'get', :path => "/projects/567/time_entries.atom" },
68 { :controller => 'timelog', :action => 'index', :project_id => '567',
69 :format => 'atom' }
70 )
71 assert_routing(
72 { :method => 'get', :path => "/projects/567/time_entries/new" },
73 { :controller => 'timelog', :action => 'new', :project_id => '567' }
74 )
75 assert_routing(
76 { :method => 'get', :path => "/projects/567/time_entries/22/edit" },
77 { :controller => 'timelog', :action => 'edit',
78 :id => '22', :project_id => '567' }
79 )
80 assert_routing(
81 { :method => 'post', :path => "/projects/567/time_entries" },
82 { :controller => 'timelog', :action => 'create',
83 :project_id => '567' }
84 )
85 assert_routing(
86 { :method => 'put', :path => "/projects/567/time_entries/22" },
87 { :controller => 'timelog', :action => 'update',
88 :id => '22', :project_id => '567' }
89 )
90 assert_routing(
91 { :method => 'delete', :path => "/projects/567/time_entries/55" },
92 { :controller => 'timelog', :action => 'destroy',
93 :id => '55', :project_id => '567' }
94 )
95 end
96
97 def test_timelogs_scoped_under_issues
98 assert_routing(
99 { :method => 'get', :path => "/issues/234/time_entries" },
100 { :controller => 'timelog', :action => 'index', :issue_id => '234' }
101 )
102 assert_routing(
103 { :method => 'get', :path => "/issues/234/time_entries.csv" },
104 { :controller => 'timelog', :action => 'index', :issue_id => '234',
105 :format => 'csv' }
106 )
107 assert_routing(
108 { :method => 'get', :path => "/issues/234/time_entries.atom" },
109 { :controller => 'timelog', :action => 'index', :issue_id => '234',
110 :format => 'atom' }
111 )
112 assert_routing(
113 { :method => 'get', :path => "/issues/234/time_entries/new" },
114 { :controller => 'timelog', :action => 'new', :issue_id => '234' }
115 )
116 assert_routing(
117 { :method => 'get', :path => "/issues/234/time_entries/22/edit" },
118 { :controller => 'timelog', :action => 'edit', :id => '22',
119 :issue_id => '234' }
120 )
121 assert_routing(
122 { :method => 'post', :path => "/issues/234/time_entries" },
123 { :controller => 'timelog', :action => 'create', :issue_id => '234' }
124 )
125 assert_routing(
126 { :method => 'put', :path => "/issues/234/time_entries/22" },
127 { :controller => 'timelog', :action => 'update', :id => '22',
128 :issue_id => '234' }
129 )
130 assert_routing(
131 { :method => 'delete', :path => "/issues/234/time_entries/55" },
132 { :controller => 'timelog', :action => 'destroy', :id => '55',
133 :issue_id => '234' }
134 )
135 end
136
137 def test_timelogs_scoped_under_project_and_issues
138 assert_routing(
139 { :method => 'get',
140 :path => "/projects/ecookbook/issues/234/time_entries" },
141 { :controller => 'timelog', :action => 'index',
142 :issue_id => '234', :project_id => 'ecookbook' }
143 )
144 assert_routing(
145 { :method => 'get',
146 :path => "/projects/ecookbook/issues/234/time_entries.csv" },
147 { :controller => 'timelog', :action => 'index',
148 :issue_id => '234', :project_id => 'ecookbook', :format => 'csv' }
149 )
150 assert_routing(
151 { :method => 'get',
152 :path => "/projects/ecookbook/issues/234/time_entries.atom" },
153 { :controller => 'timelog', :action => 'index',
154 :issue_id => '234', :project_id => 'ecookbook', :format => 'atom' }
155 )
156 assert_routing(
157 { :method => 'get',
158 :path => "/projects/ecookbook/issues/234/time_entries/new" },
159 { :controller => 'timelog', :action => 'new',
160 :issue_id => '234', :project_id => 'ecookbook' }
161 )
162 assert_routing(
163 { :method => 'get',
164 :path => "/projects/ecookbook/issues/234/time_entries/22/edit" },
165 { :controller => 'timelog', :action => 'edit', :id => '22',
166 :issue_id => '234', :project_id => 'ecookbook' }
167 )
168 assert_routing(
169 { :method => 'post',
170 :path => "/projects/ecookbook/issues/234/time_entries" },
171 { :controller => 'timelog', :action => 'create',
172 :issue_id => '234', :project_id => 'ecookbook' }
173 )
174 assert_routing(
175 { :method => 'put',
176 :path => "/projects/ecookbook/issues/234/time_entries/22" },
177 { :controller => 'timelog', :action => 'update', :id => '22',
178 :issue_id => '234', :project_id => 'ecookbook' }
179 )
180 assert_routing(
181 { :method => 'delete',
182 :path => "/projects/ecookbook/issues/234/time_entries/55" },
183 { :controller => 'timelog', :action => 'destroy', :id => '55',
184 :issue_id => '234', :project_id => 'ecookbook' }
185 )
186 assert_routing(
187 { :method => 'get',
188 :path => "/time_entries/report" },
189 { :controller => 'timelog', :action => 'report' }
190 )
191 assert_routing(
192 { :method => 'get',
193 :path => "/projects/567/time_entries/report" },
194 { :controller => 'timelog', :action => 'report', :project_id => '567' }
195 )
196 assert_routing(
197 { :method => 'get',
198 :path => "/projects/567/time_entries/report.csv" },
199 { :controller => 'timelog', :action => 'report', :project_id => '567',
200 :format => 'csv' }
201 )
202 end
203 end
@@ -1,849 +1,666
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/auto_complete" },
119 119 { :controller => 'auto_completes', :action => 'issues' }
120 120 )
121 121 assert_routing(
122 122 { :method => 'get', :path => "/issues/preview/123" },
123 123 { :controller => 'previews', :action => 'issue', :id => '123' }
124 124 )
125 125 assert_routing(
126 126 { :method => 'post', :path => "/issues/preview/123" },
127 127 { :controller => 'previews', :action => 'issue', :id => '123' }
128 128 )
129 129 assert_routing(
130 130 { :method => 'get', :path => "/issues/context_menu" },
131 131 { :controller => 'context_menus', :action => 'issues' }
132 132 )
133 133 assert_routing(
134 134 { :method => 'post', :path => "/issues/context_menu" },
135 135 { :controller => 'context_menus', :action => 'issues' }
136 136 )
137 137 assert_routing(
138 138 { :method => 'get', :path => "/issues/bulk_edit" },
139 139 { :controller => 'issues', :action => 'bulk_edit' }
140 140 )
141 141 assert_routing(
142 142 { :method => 'post', :path => "/issues/bulk_update" },
143 143 { :controller => 'issues', :action => 'bulk_update' }
144 144 )
145 145 end
146 146
147 147 def test_issue_categories
148 148 assert_routing(
149 149 { :method => 'get', :path => "/projects/foo/issue_categories" },
150 150 { :controller => 'issue_categories', :action => 'index',
151 151 :project_id => 'foo' }
152 152 )
153 153 assert_routing(
154 154 { :method => 'get', :path => "/projects/foo/issue_categories.xml" },
155 155 { :controller => 'issue_categories', :action => 'index',
156 156 :project_id => 'foo', :format => 'xml' }
157 157 )
158 158 assert_routing(
159 159 { :method => 'get', :path => "/projects/foo/issue_categories.json" },
160 160 { :controller => 'issue_categories', :action => 'index',
161 161 :project_id => 'foo', :format => 'json' }
162 162 )
163 163 assert_routing(
164 164 { :method => 'get', :path => "/projects/foo/issue_categories/new" },
165 165 { :controller => 'issue_categories', :action => 'new',
166 166 :project_id => 'foo' }
167 167 )
168 168 assert_routing(
169 169 { :method => 'post', :path => "/projects/foo/issue_categories" },
170 170 { :controller => 'issue_categories', :action => 'create',
171 171 :project_id => 'foo' }
172 172 )
173 173 assert_routing(
174 174 { :method => 'post', :path => "/projects/foo/issue_categories.xml" },
175 175 { :controller => 'issue_categories', :action => 'create',
176 176 :project_id => 'foo', :format => 'xml' }
177 177 )
178 178 assert_routing(
179 179 { :method => 'post', :path => "/projects/foo/issue_categories.json" },
180 180 { :controller => 'issue_categories', :action => 'create',
181 181 :project_id => 'foo', :format => 'json' }
182 182 )
183 183 assert_routing(
184 184 { :method => 'get', :path => "/issue_categories/1" },
185 185 { :controller => 'issue_categories', :action => 'show', :id => '1' }
186 186 )
187 187 assert_routing(
188 188 { :method => 'get', :path => "/issue_categories/1.xml" },
189 189 { :controller => 'issue_categories', :action => 'show', :id => '1',
190 190 :format => 'xml' }
191 191 )
192 192 assert_routing(
193 193 { :method => 'get', :path => "/issue_categories/1.json" },
194 194 { :controller => 'issue_categories', :action => 'show', :id => '1',
195 195 :format => 'json' }
196 196 )
197 197 assert_routing(
198 198 { :method => 'get', :path => "/issue_categories/1/edit" },
199 199 { :controller => 'issue_categories', :action => 'edit', :id => '1' }
200 200 )
201 201 assert_routing(
202 202 { :method => 'put', :path => "/issue_categories/1" },
203 203 { :controller => 'issue_categories', :action => 'update', :id => '1' }
204 204 )
205 205 assert_routing(
206 206 { :method => 'put', :path => "/issue_categories/1.xml" },
207 207 { :controller => 'issue_categories', :action => 'update', :id => '1',
208 208 :format => 'xml' }
209 209 )
210 210 assert_routing(
211 211 { :method => 'put', :path => "/issue_categories/1.json" },
212 212 { :controller => 'issue_categories', :action => 'update', :id => '1',
213 213 :format => 'json' }
214 214 )
215 215 assert_routing(
216 216 { :method => 'delete', :path => "/issue_categories/1" },
217 217 { :controller => 'issue_categories', :action => 'destroy', :id => '1' }
218 218 )
219 219 assert_routing(
220 220 { :method => 'delete', :path => "/issue_categories/1.xml" },
221 221 { :controller => 'issue_categories', :action => 'destroy', :id => '1',
222 222 :format => 'xml' }
223 223 )
224 224 assert_routing(
225 225 { :method => 'delete', :path => "/issue_categories/1.json" },
226 226 { :controller => 'issue_categories', :action => 'destroy', :id => '1',
227 227 :format => 'json' }
228 228 )
229 229 end
230 230
231 231 def test_news
232 232 assert_routing(
233 233 { :method => 'get', :path => "/news" },
234 234 { :controller => 'news', :action => 'index' }
235 235 )
236 236 assert_routing(
237 237 { :method => 'get', :path => "/news.atom" },
238 238 { :controller => 'news', :action => 'index', :format => 'atom' }
239 239 )
240 240 assert_routing(
241 241 { :method => 'get', :path => "/news.xml" },
242 242 { :controller => 'news', :action => 'index', :format => 'xml' }
243 243 )
244 244 assert_routing(
245 245 { :method => 'get', :path => "/news.json" },
246 246 { :controller => 'news', :action => 'index', :format => 'json' }
247 247 )
248 248 assert_routing(
249 249 { :method => 'get', :path => "/projects/567/news" },
250 250 { :controller => 'news', :action => 'index', :project_id => '567' }
251 251 )
252 252 assert_routing(
253 253 { :method => 'get', :path => "/projects/567/news.atom" },
254 254 { :controller => 'news', :action => 'index', :format => 'atom',
255 255 :project_id => '567' }
256 256 )
257 257 assert_routing(
258 258 { :method => 'get', :path => "/projects/567/news.xml" },
259 259 { :controller => 'news', :action => 'index', :format => 'xml',
260 260 :project_id => '567' }
261 261 )
262 262 assert_routing(
263 263 { :method => 'get', :path => "/projects/567/news.json" },
264 264 { :controller => 'news', :action => 'index', :format => 'json',
265 265 :project_id => '567' }
266 266 )
267 267 assert_routing(
268 268 { :method => 'get', :path => "/news/2" },
269 269 { :controller => 'news', :action => 'show', :id => '2' }
270 270 )
271 271 assert_routing(
272 272 { :method => 'get', :path => "/projects/567/news/new" },
273 273 { :controller => 'news', :action => 'new', :project_id => '567' }
274 274 )
275 275 assert_routing(
276 276 { :method => 'get', :path => "/news/234" },
277 277 { :controller => 'news', :action => 'show', :id => '234' }
278 278 )
279 279 assert_routing(
280 280 { :method => 'get', :path => "/news/567/edit" },
281 281 { :controller => 'news', :action => 'edit', :id => '567' }
282 282 )
283 283 assert_routing(
284 284 { :method => 'get', :path => "/news/preview" },
285 285 { :controller => 'previews', :action => 'news' }
286 286 )
287 287 assert_routing(
288 288 { :method => 'post', :path => "/projects/567/news" },
289 289 { :controller => 'news', :action => 'create', :project_id => '567' }
290 290 )
291 291 assert_routing(
292 292 { :method => 'post', :path => "/news/567/comments" },
293 293 { :controller => 'comments', :action => 'create', :id => '567' }
294 294 )
295 295 assert_routing(
296 296 { :method => 'put', :path => "/news/567" },
297 297 { :controller => 'news', :action => 'update', :id => '567' }
298 298 )
299 299 assert_routing(
300 300 { :method => 'delete', :path => "/news/567" },
301 301 { :controller => 'news', :action => 'destroy', :id => '567' }
302 302 )
303 303 assert_routing(
304 304 { :method => 'delete', :path => "/news/567/comments/15" },
305 305 { :controller => 'comments', :action => 'destroy', :id => '567',
306 306 :comment_id => '15' }
307 307 )
308 308 end
309 309
310 310 def test_projects
311 311 assert_routing(
312 312 { :method => 'get', :path => "/projects" },
313 313 { :controller => 'projects', :action => 'index' }
314 314 )
315 315 assert_routing(
316 316 { :method => 'get', :path => "/projects.atom" },
317 317 { :controller => 'projects', :action => 'index', :format => 'atom' }
318 318 )
319 319 assert_routing(
320 320 { :method => 'get', :path => "/projects.xml" },
321 321 { :controller => 'projects', :action => 'index', :format => 'xml' }
322 322 )
323 323 assert_routing(
324 324 { :method => 'get', :path => "/projects/new" },
325 325 { :controller => 'projects', :action => 'new' }
326 326 )
327 327 assert_routing(
328 328 { :method => 'get', :path => "/projects/test" },
329 329 { :controller => 'projects', :action => 'show', :id => 'test' }
330 330 )
331 331 assert_routing(
332 332 { :method => 'get', :path => "/projects/1.xml" },
333 333 { :controller => 'projects', :action => 'show', :id => '1',
334 334 :format => 'xml' }
335 335 )
336 336 assert_routing(
337 337 { :method => 'get', :path => "/projects/4223/settings" },
338 338 { :controller => 'projects', :action => 'settings', :id => '4223' }
339 339 )
340 340 assert_routing(
341 341 { :method => 'get', :path => "/projects/4223/settings/members" },
342 342 { :controller => 'projects', :action => 'settings', :id => '4223',
343 343 :tab => 'members' }
344 344 )
345 345 assert_routing(
346 346 { :method => 'get', :path => "/projects/33/roadmap" },
347 347 { :controller => 'versions', :action => 'index', :project_id => '33' }
348 348 )
349 349 assert_routing(
350 350 { :method => 'get', :path => "/projects/33/activity" },
351 351 { :controller => 'activities', :action => 'index', :id => '33' }
352 352 )
353 353 assert_routing(
354 354 { :method => 'get', :path => "/projects/33/activity.atom" },
355 355 { :controller => 'activities', :action => 'index', :id => '33',
356 356 :format => 'atom' }
357 357 )
358 358 assert_routing(
359 359 { :method => 'post', :path => "/projects" },
360 360 { :controller => 'projects', :action => 'create' }
361 361 )
362 362 assert_routing(
363 363 { :method => 'post', :path => "/projects.xml" },
364 364 { :controller => 'projects', :action => 'create', :format => 'xml' }
365 365 )
366 366 assert_routing(
367 367 { :method => 'post', :path => "/projects/64/archive" },
368 368 { :controller => 'projects', :action => 'archive', :id => '64' }
369 369 )
370 370 assert_routing(
371 371 { :method => 'post', :path => "/projects/64/unarchive" },
372 372 { :controller => 'projects', :action => 'unarchive', :id => '64' }
373 373 )
374 374 assert_routing(
375 375 { :method => 'put', :path => "/projects/64/enumerations" },
376 376 { :controller => 'project_enumerations', :action => 'update',
377 377 :project_id => '64' }
378 378 )
379 379 assert_routing(
380 380 { :method => 'put', :path => "/projects/4223" },
381 381 { :controller => 'projects', :action => 'update', :id => '4223' }
382 382 )
383 383 assert_routing(
384 384 { :method => 'put', :path => "/projects/1.xml" },
385 385 { :controller => 'projects', :action => 'update', :id => '1',
386 386 :format => 'xml' }
387 387 )
388 388 assert_routing(
389 389 { :method => 'delete', :path => "/projects/64" },
390 390 { :controller => 'projects', :action => 'destroy', :id => '64' }
391 391 )
392 392 assert_routing(
393 393 { :method => 'delete', :path => "/projects/1.xml" },
394 394 { :controller => 'projects', :action => 'destroy', :id => '1',
395 395 :format => 'xml' }
396 396 )
397 397 assert_routing(
398 398 { :method => 'delete', :path => "/projects/64/enumerations" },
399 399 { :controller => 'project_enumerations', :action => 'destroy',
400 400 :project_id => '64' }
401 401 )
402 402 end
403 403
404 404 def test_queries
405 405 assert_routing(
406 406 { :method => 'get', :path => "/queries.xml" },
407 407 { :controller => 'queries', :action => 'index', :format => 'xml' }
408 408 )
409 409 assert_routing(
410 410 { :method => 'get', :path => "/queries.json" },
411 411 { :controller => 'queries', :action => 'index', :format => 'json' }
412 412 )
413 413 assert_routing(
414 414 { :method => 'get', :path => "/queries/new" },
415 415 { :controller => 'queries', :action => 'new' }
416 416 )
417 417 assert_routing(
418 418 { :method => 'get', :path => "/projects/redmine/queries/new" },
419 419 { :controller => 'queries', :action => 'new', :project_id => 'redmine' }
420 420 )
421 421 assert_routing(
422 422 { :method => 'post', :path => "/queries" },
423 423 { :controller => 'queries', :action => 'create' }
424 424 )
425 425 assert_routing(
426 426 { :method => 'post', :path => "/projects/redmine/queries" },
427 427 { :controller => 'queries', :action => 'create', :project_id => 'redmine' }
428 428 )
429 429 assert_routing(
430 430 { :method => 'get', :path => "/queries/1/edit" },
431 431 { :controller => 'queries', :action => 'edit', :id => '1' }
432 432 )
433 433 assert_routing(
434 434 { :method => 'put', :path => "/queries/1" },
435 435 { :controller => 'queries', :action => 'update', :id => '1' }
436 436 )
437 437 assert_routing(
438 438 { :method => 'delete', :path => "/queries/1" },
439 439 { :controller => 'queries', :action => 'destroy', :id => '1' }
440 440 )
441 441 end
442 442
443 443 def test_roles
444 444 assert_routing(
445 445 { :method => 'get', :path => "/roles" },
446 446 { :controller => 'roles', :action => 'index' }
447 447 )
448 448 assert_routing(
449 449 { :method => 'get', :path => "/roles/new" },
450 450 { :controller => 'roles', :action => 'new' }
451 451 )
452 452 assert_routing(
453 453 { :method => 'post', :path => "/roles" },
454 454 { :controller => 'roles', :action => 'create' }
455 455 )
456 456 assert_routing(
457 457 { :method => 'get', :path => "/roles/2/edit" },
458 458 { :controller => 'roles', :action => 'edit', :id => '2' }
459 459 )
460 460 assert_routing(
461 461 { :method => 'put', :path => "/roles/2" },
462 462 { :controller => 'roles', :action => 'update', :id => '2' }
463 463 )
464 464 assert_routing(
465 465 { :method => 'delete', :path => "/roles/2" },
466 466 { :controller => 'roles', :action => 'destroy', :id => '2' }
467 467 )
468 468 assert_routing(
469 469 { :method => 'get', :path => "/roles/permissions" },
470 470 { :controller => 'roles', :action => 'permissions' }
471 471 )
472 472 assert_routing(
473 473 { :method => 'post', :path => "/roles/permissions" },
474 474 { :controller => 'roles', :action => 'permissions' }
475 475 )
476 476 end
477 477
478 def test_timelogs_global
479 assert_routing(
480 { :method => 'get', :path => "/time_entries" },
481 { :controller => 'timelog', :action => 'index' }
482 )
483 assert_routing(
484 { :method => 'get', :path => "/time_entries.csv" },
485 { :controller => 'timelog', :action => 'index', :format => 'csv' }
486 )
487 assert_routing(
488 { :method => 'get', :path => "/time_entries.atom" },
489 { :controller => 'timelog', :action => 'index', :format => 'atom' }
490 )
491 assert_routing(
492 { :method => 'get', :path => "/time_entries/new" },
493 { :controller => 'timelog', :action => 'new' }
494 )
495 assert_routing(
496 { :method => 'get', :path => "/time_entries/22/edit" },
497 { :controller => 'timelog', :action => 'edit', :id => '22' }
498 )
499 assert_routing(
500 { :method => 'post', :path => "/time_entries" },
501 { :controller => 'timelog', :action => 'create' }
502 )
503 assert_routing(
504 { :method => 'put', :path => "/time_entries/22" },
505 { :controller => 'timelog', :action => 'update', :id => '22' }
506 )
507 assert_routing(
508 { :method => 'delete', :path => "/time_entries/55" },
509 { :controller => 'timelog', :action => 'destroy', :id => '55' }
510 )
511 end
512
513 def test_timelogs_scoped_under_project
514 assert_routing(
515 { :method => 'get', :path => "/projects/567/time_entries" },
516 { :controller => 'timelog', :action => 'index', :project_id => '567' }
517 )
518 assert_routing(
519 { :method => 'get', :path => "/projects/567/time_entries.csv" },
520 { :controller => 'timelog', :action => 'index', :project_id => '567',
521 :format => 'csv' }
522 )
523 assert_routing(
524 { :method => 'get', :path => "/projects/567/time_entries.atom" },
525 { :controller => 'timelog', :action => 'index', :project_id => '567',
526 :format => 'atom' }
527 )
528 assert_routing(
529 { :method => 'get', :path => "/projects/567/time_entries/new" },
530 { :controller => 'timelog', :action => 'new', :project_id => '567' }
531 )
532 assert_routing(
533 { :method => 'get', :path => "/projects/567/time_entries/22/edit" },
534 { :controller => 'timelog', :action => 'edit',
535 :id => '22', :project_id => '567' }
536 )
537 assert_routing(
538 { :method => 'post', :path => "/projects/567/time_entries" },
539 { :controller => 'timelog', :action => 'create',
540 :project_id => '567' }
541 )
542 assert_routing(
543 { :method => 'put', :path => "/projects/567/time_entries/22" },
544 { :controller => 'timelog', :action => 'update',
545 :id => '22', :project_id => '567' }
546 )
547 assert_routing(
548 { :method => 'delete', :path => "/projects/567/time_entries/55" },
549 { :controller => 'timelog', :action => 'destroy',
550 :id => '55', :project_id => '567' }
551 )
552 end
553
554 def test_timelogs_scoped_under_issues
555 assert_routing(
556 { :method => 'get', :path => "/issues/234/time_entries" },
557 { :controller => 'timelog', :action => 'index', :issue_id => '234' }
558 )
559 assert_routing(
560 { :method => 'get', :path => "/issues/234/time_entries.csv" },
561 { :controller => 'timelog', :action => 'index', :issue_id => '234',
562 :format => 'csv' }
563 )
564 assert_routing(
565 { :method => 'get', :path => "/issues/234/time_entries.atom" },
566 { :controller => 'timelog', :action => 'index', :issue_id => '234',
567 :format => 'atom' }
568 )
569 assert_routing(
570 { :method => 'get', :path => "/issues/234/time_entries/new" },
571 { :controller => 'timelog', :action => 'new', :issue_id => '234' }
572 )
573 assert_routing(
574 { :method => 'get', :path => "/issues/234/time_entries/22/edit" },
575 { :controller => 'timelog', :action => 'edit', :id => '22',
576 :issue_id => '234' }
577 )
578 assert_routing(
579 { :method => 'post', :path => "/issues/234/time_entries" },
580 { :controller => 'timelog', :action => 'create', :issue_id => '234' }
581 )
582 assert_routing(
583 { :method => 'put', :path => "/issues/234/time_entries/22" },
584 { :controller => 'timelog', :action => 'update', :id => '22',
585 :issue_id => '234' }
586 )
587 assert_routing(
588 { :method => 'delete', :path => "/issues/234/time_entries/55" },
589 { :controller => 'timelog', :action => 'destroy', :id => '55',
590 :issue_id => '234' }
591 )
592 end
593
594 def test_timelogs_scoped_under_project_and_issues
595 assert_routing(
596 { :method => 'get',
597 :path => "/projects/ecookbook/issues/234/time_entries" },
598 { :controller => 'timelog', :action => 'index',
599 :issue_id => '234', :project_id => 'ecookbook' }
600 )
601 assert_routing(
602 { :method => 'get',
603 :path => "/projects/ecookbook/issues/234/time_entries.csv" },
604 { :controller => 'timelog', :action => 'index',
605 :issue_id => '234', :project_id => 'ecookbook', :format => 'csv' }
606 )
607 assert_routing(
608 { :method => 'get',
609 :path => "/projects/ecookbook/issues/234/time_entries.atom" },
610 { :controller => 'timelog', :action => 'index',
611 :issue_id => '234', :project_id => 'ecookbook', :format => 'atom' }
612 )
613 assert_routing(
614 { :method => 'get',
615 :path => "/projects/ecookbook/issues/234/time_entries/new" },
616 { :controller => 'timelog', :action => 'new',
617 :issue_id => '234', :project_id => 'ecookbook' }
618 )
619 assert_routing(
620 { :method => 'get',
621 :path => "/projects/ecookbook/issues/234/time_entries/22/edit" },
622 { :controller => 'timelog', :action => 'edit', :id => '22',
623 :issue_id => '234', :project_id => 'ecookbook' }
624 )
625 assert_routing(
626 { :method => 'post',
627 :path => "/projects/ecookbook/issues/234/time_entries" },
628 { :controller => 'timelog', :action => 'create',
629 :issue_id => '234', :project_id => 'ecookbook' }
630 )
631 assert_routing(
632 { :method => 'put',
633 :path => "/projects/ecookbook/issues/234/time_entries/22" },
634 { :controller => 'timelog', :action => 'update', :id => '22',
635 :issue_id => '234', :project_id => 'ecookbook' }
636 )
637 assert_routing(
638 { :method => 'delete',
639 :path => "/projects/ecookbook/issues/234/time_entries/55" },
640 { :controller => 'timelog', :action => 'destroy', :id => '55',
641 :issue_id => '234', :project_id => 'ecookbook' }
642 )
643 assert_routing(
644 { :method => 'get',
645 :path => "/time_entries/report" },
646 { :controller => 'timelog', :action => 'report' }
647 )
648 assert_routing(
649 { :method => 'get',
650 :path => "/projects/567/time_entries/report" },
651 { :controller => 'timelog', :action => 'report', :project_id => '567' }
652 )
653 assert_routing(
654 { :method => 'get',
655 :path => "/projects/567/time_entries/report.csv" },
656 { :controller => 'timelog', :action => 'report', :project_id => '567',
657 :format => 'csv' }
658 )
659 end
660
661 478 def test_users
662 479 assert_routing(
663 480 { :method => 'get', :path => "/users" },
664 481 { :controller => 'users', :action => 'index' }
665 482 )
666 483 assert_routing(
667 484 { :method => 'get', :path => "/users.xml" },
668 485 { :controller => 'users', :action => 'index', :format => 'xml' }
669 486 )
670 487 assert_routing(
671 488 { :method => 'get', :path => "/users/44" },
672 489 { :controller => 'users', :action => 'show', :id => '44' }
673 490 )
674 491 assert_routing(
675 492 { :method => 'get', :path => "/users/44.xml" },
676 493 { :controller => 'users', :action => 'show', :id => '44',
677 494 :format => 'xml' }
678 495 )
679 496 assert_routing(
680 497 { :method => 'get', :path => "/users/current" },
681 498 { :controller => 'users', :action => 'show', :id => 'current' }
682 499 )
683 500 assert_routing(
684 501 { :method => 'get', :path => "/users/current.xml" },
685 502 { :controller => 'users', :action => 'show', :id => 'current',
686 503 :format => 'xml' }
687 504 )
688 505 assert_routing(
689 506 { :method => 'get', :path => "/users/new" },
690 507 { :controller => 'users', :action => 'new' }
691 508 )
692 509 assert_routing(
693 510 { :method => 'get', :path => "/users/444/edit" },
694 511 { :controller => 'users', :action => 'edit', :id => '444' }
695 512 )
696 513 assert_routing(
697 514 { :method => 'post', :path => "/users" },
698 515 { :controller => 'users', :action => 'create' }
699 516 )
700 517 assert_routing(
701 518 { :method => 'post', :path => "/users.xml" },
702 519 { :controller => 'users', :action => 'create', :format => 'xml' }
703 520 )
704 521 assert_routing(
705 522 { :method => 'put', :path => "/users/444" },
706 523 { :controller => 'users', :action => 'update', :id => '444' }
707 524 )
708 525 assert_routing(
709 526 { :method => 'put', :path => "/users/444.xml" },
710 527 { :controller => 'users', :action => 'update', :id => '444',
711 528 :format => 'xml' }
712 529 )
713 530 assert_routing(
714 531 { :method => 'delete', :path => "/users/44" },
715 532 { :controller => 'users', :action => 'destroy', :id => '44' }
716 533 )
717 534 assert_routing(
718 535 { :method => 'delete', :path => "/users/44.xml" },
719 536 { :controller => 'users', :action => 'destroy', :id => '44',
720 537 :format => 'xml' }
721 538 )
722 539 assert_routing(
723 540 { :method => 'post', :path => "/users/123/memberships" },
724 541 { :controller => 'users', :action => 'edit_membership',
725 542 :id => '123' }
726 543 )
727 544 assert_routing(
728 545 { :method => 'put', :path => "/users/123/memberships/55" },
729 546 { :controller => 'users', :action => 'edit_membership',
730 547 :id => '123', :membership_id => '55' }
731 548 )
732 549 assert_routing(
733 550 { :method => 'delete', :path => "/users/123/memberships/55" },
734 551 { :controller => 'users', :action => 'destroy_membership',
735 552 :id => '123', :membership_id => '55' }
736 553 )
737 554 end
738 555
739 556 def test_welcome
740 557 assert_routing(
741 558 { :method => 'get', :path => "/robots.txt" },
742 559 { :controller => 'welcome', :action => 'robots' }
743 560 )
744 561 end
745 562
746 563 def test_wiki_singular_projects_pages
747 564 assert_routing(
748 565 { :method => 'get', :path => "/projects/567/wiki" },
749 566 { :controller => 'wiki', :action => 'show', :project_id => '567' }
750 567 )
751 568 assert_routing(
752 569 { :method => 'get', :path => "/projects/567/wiki/lalala" },
753 570 { :controller => 'wiki', :action => 'show', :project_id => '567',
754 571 :id => 'lalala' }
755 572 )
756 573 assert_routing(
757 574 { :method => 'get', :path => "/projects/567/wiki/my_page/edit" },
758 575 { :controller => 'wiki', :action => 'edit', :project_id => '567',
759 576 :id => 'my_page' }
760 577 )
761 578 assert_routing(
762 579 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/history" },
763 580 { :controller => 'wiki', :action => 'history', :project_id => '1',
764 581 :id => 'CookBook_documentation' }
765 582 )
766 583 assert_routing(
767 584 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff" },
768 585 { :controller => 'wiki', :action => 'diff', :project_id => '1',
769 586 :id => 'CookBook_documentation' }
770 587 )
771 588 assert_routing(
772 589 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2" },
773 590 { :controller => 'wiki', :action => 'diff', :project_id => '1',
774 591 :id => 'CookBook_documentation', :version => '2' }
775 592 )
776 593 assert_routing(
777 594 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2/vs/1" },
778 595 { :controller => 'wiki', :action => 'diff', :project_id => '1',
779 596 :id => 'CookBook_documentation', :version => '2', :version_from => '1' }
780 597 )
781 598 assert_routing(
782 599 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/annotate/2" },
783 600 { :controller => 'wiki', :action => 'annotate', :project_id => '1',
784 601 :id => 'CookBook_documentation', :version => '2' }
785 602 )
786 603 assert_routing(
787 604 { :method => 'get', :path => "/projects/22/wiki/ladida/rename" },
788 605 { :controller => 'wiki', :action => 'rename', :project_id => '22',
789 606 :id => 'ladida' }
790 607 )
791 608 assert_routing(
792 609 { :method => 'get', :path => "/projects/567/wiki/index" },
793 610 { :controller => 'wiki', :action => 'index', :project_id => '567' }
794 611 )
795 612 assert_routing(
796 613 { :method => 'get', :path => "/projects/567/wiki/date_index" },
797 614 { :controller => 'wiki', :action => 'date_index', :project_id => '567' }
798 615 )
799 616 assert_routing(
800 617 { :method => 'get', :path => "/projects/567/wiki/export" },
801 618 { :controller => 'wiki', :action => 'export', :project_id => '567' }
802 619 )
803 620 assert_routing(
804 621 { :method => 'post', :path => "/projects/567/wiki/CookBook_documentation/preview" },
805 622 { :controller => 'wiki', :action => 'preview', :project_id => '567',
806 623 :id => 'CookBook_documentation' }
807 624 )
808 625 assert_routing(
809 626 { :method => 'post', :path => "/projects/22/wiki/ladida/rename" },
810 627 { :controller => 'wiki', :action => 'rename', :project_id => '22',
811 628 :id => 'ladida' }
812 629 )
813 630 assert_routing(
814 631 { :method => 'post', :path => "/projects/22/wiki/ladida/protect" },
815 632 { :controller => 'wiki', :action => 'protect', :project_id => '22',
816 633 :id => 'ladida' }
817 634 )
818 635 assert_routing(
819 636 { :method => 'post', :path => "/projects/22/wiki/ladida/add_attachment" },
820 637 { :controller => 'wiki', :action => 'add_attachment', :project_id => '22',
821 638 :id => 'ladida' }
822 639 )
823 640 assert_routing(
824 641 { :method => 'put', :path => "/projects/567/wiki/my_page" },
825 642 { :controller => 'wiki', :action => 'update', :project_id => '567',
826 643 :id => 'my_page' }
827 644 )
828 645 assert_routing(
829 646 { :method => 'delete', :path => "/projects/22/wiki/ladida" },
830 647 { :controller => 'wiki', :action => 'destroy', :project_id => '22',
831 648 :id => 'ladida' }
832 649 )
833 650 end
834 651
835 652 def test_wikis_plural_admin_setup
836 653 assert_routing(
837 654 { :method => 'get', :path => "/projects/ladida/wiki/destroy" },
838 655 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
839 656 )
840 657 assert_routing(
841 658 { :method => 'post', :path => "/projects/ladida/wiki" },
842 659 { :controller => 'wikis', :action => 'edit', :id => 'ladida' }
843 660 )
844 661 assert_routing(
845 662 { :method => 'post', :path => "/projects/ladida/wiki/destroy" },
846 663 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
847 664 )
848 665 end
849 666 end
General Comments 0
You need to be logged in to leave comments. Login now