@@ -0,0 +1,86 | |||
|
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 RoutingNewsTest < ActionController::IntegrationTest | |
|
21 | def test_news | |
|
22 | assert_routing( | |
|
23 | { :method => 'get', :path => "/news" }, | |
|
24 | { :controller => 'news', :action => 'index' } | |
|
25 | ) | |
|
26 | assert_routing( | |
|
27 | { :method => 'get', :path => "/news.atom" }, | |
|
28 | { :controller => 'news', :action => 'index', :format => 'atom' } | |
|
29 | ) | |
|
30 | assert_routing( | |
|
31 | { :method => 'get', :path => "/news.xml" }, | |
|
32 | { :controller => 'news', :action => 'index', :format => 'xml' } | |
|
33 | ) | |
|
34 | assert_routing( | |
|
35 | { :method => 'get', :path => "/news.json" }, | |
|
36 | { :controller => 'news', :action => 'index', :format => 'json' } | |
|
37 | ) | |
|
38 | assert_routing( | |
|
39 | { :method => 'get', :path => "/projects/567/news" }, | |
|
40 | { :controller => 'news', :action => 'index', :project_id => '567' } | |
|
41 | ) | |
|
42 | assert_routing( | |
|
43 | { :method => 'get', :path => "/projects/567/news.atom" }, | |
|
44 | { :controller => 'news', :action => 'index', :format => 'atom', | |
|
45 | :project_id => '567' } | |
|
46 | ) | |
|
47 | assert_routing( | |
|
48 | { :method => 'get', :path => "/projects/567/news.xml" }, | |
|
49 | { :controller => 'news', :action => 'index', :format => 'xml', | |
|
50 | :project_id => '567' } | |
|
51 | ) | |
|
52 | assert_routing( | |
|
53 | { :method => 'get', :path => "/projects/567/news.json" }, | |
|
54 | { :controller => 'news', :action => 'index', :format => 'json', | |
|
55 | :project_id => '567' } | |
|
56 | ) | |
|
57 | assert_routing( | |
|
58 | { :method => 'get', :path => "/news/2" }, | |
|
59 | { :controller => 'news', :action => 'show', :id => '2' } | |
|
60 | ) | |
|
61 | assert_routing( | |
|
62 | { :method => 'get', :path => "/projects/567/news/new" }, | |
|
63 | { :controller => 'news', :action => 'new', :project_id => '567' } | |
|
64 | ) | |
|
65 | assert_routing( | |
|
66 | { :method => 'get', :path => "/news/234" }, | |
|
67 | { :controller => 'news', :action => 'show', :id => '234' } | |
|
68 | ) | |
|
69 | assert_routing( | |
|
70 | { :method => 'get', :path => "/news/567/edit" }, | |
|
71 | { :controller => 'news', :action => 'edit', :id => '567' } | |
|
72 | ) | |
|
73 | assert_routing( | |
|
74 | { :method => 'post', :path => "/projects/567/news" }, | |
|
75 | { :controller => 'news', :action => 'create', :project_id => '567' } | |
|
76 | ) | |
|
77 | assert_routing( | |
|
78 | { :method => 'put', :path => "/news/567" }, | |
|
79 | { :controller => 'news', :action => 'update', :id => '567' } | |
|
80 | ) | |
|
81 | assert_routing( | |
|
82 | { :method => 'delete', :path => "/news/567" }, | |
|
83 | { :controller => 'news', :action => 'destroy', :id => '567' } | |
|
84 | ) | |
|
85 | end | |
|
86 | end |
@@ -1,310 +1,244 | |||
|
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 | def test_news | |
|
22 | assert_routing( | |
|
23 | { :method => 'get', :path => "/news" }, | |
|
24 | { :controller => 'news', :action => 'index' } | |
|
25 | ) | |
|
26 | assert_routing( | |
|
27 | { :method => 'get', :path => "/news.atom" }, | |
|
28 | { :controller => 'news', :action => 'index', :format => 'atom' } | |
|
29 | ) | |
|
30 | assert_routing( | |
|
31 | { :method => 'get', :path => "/news.xml" }, | |
|
32 | { :controller => 'news', :action => 'index', :format => 'xml' } | |
|
33 | ) | |
|
34 | assert_routing( | |
|
35 | { :method => 'get', :path => "/news.json" }, | |
|
36 | { :controller => 'news', :action => 'index', :format => 'json' } | |
|
37 | ) | |
|
38 | assert_routing( | |
|
39 | { :method => 'get', :path => "/projects/567/news" }, | |
|
40 | { :controller => 'news', :action => 'index', :project_id => '567' } | |
|
41 | ) | |
|
42 | assert_routing( | |
|
43 | { :method => 'get', :path => "/projects/567/news.atom" }, | |
|
44 | { :controller => 'news', :action => 'index', :format => 'atom', | |
|
45 | :project_id => '567' } | |
|
46 | ) | |
|
47 | assert_routing( | |
|
48 | { :method => 'get', :path => "/projects/567/news.xml" }, | |
|
49 | { :controller => 'news', :action => 'index', :format => 'xml', | |
|
50 | :project_id => '567' } | |
|
51 | ) | |
|
52 | assert_routing( | |
|
53 | { :method => 'get', :path => "/projects/567/news.json" }, | |
|
54 | { :controller => 'news', :action => 'index', :format => 'json', | |
|
55 | :project_id => '567' } | |
|
56 | ) | |
|
57 | assert_routing( | |
|
58 | { :method => 'get', :path => "/news/2" }, | |
|
59 | { :controller => 'news', :action => 'show', :id => '2' } | |
|
60 | ) | |
|
61 | assert_routing( | |
|
62 | { :method => 'get', :path => "/projects/567/news/new" }, | |
|
63 | { :controller => 'news', :action => 'new', :project_id => '567' } | |
|
64 | ) | |
|
65 | assert_routing( | |
|
66 | { :method => 'get', :path => "/news/234" }, | |
|
67 | { :controller => 'news', :action => 'show', :id => '234' } | |
|
68 | ) | |
|
69 | assert_routing( | |
|
70 | { :method => 'get', :path => "/news/567/edit" }, | |
|
71 | { :controller => 'news', :action => 'edit', :id => '567' } | |
|
72 | ) | |
|
73 | assert_routing( | |
|
74 | { :method => 'post', :path => "/projects/567/news" }, | |
|
75 | { :controller => 'news', :action => 'create', :project_id => '567' } | |
|
76 | ) | |
|
77 | assert_routing( | |
|
78 | { :method => 'put', :path => "/news/567" }, | |
|
79 | { :controller => 'news', :action => 'update', :id => '567' } | |
|
80 | ) | |
|
81 | assert_routing( | |
|
82 | { :method => 'delete', :path => "/news/567" }, | |
|
83 | { :controller => 'news', :action => 'destroy', :id => '567' } | |
|
84 | ) | |
|
85 | end | |
|
86 | ||
|
87 | 21 | def test_projects |
|
88 | 22 | assert_routing( |
|
89 | 23 | { :method => 'get', :path => "/projects" }, |
|
90 | 24 | { :controller => 'projects', :action => 'index' } |
|
91 | 25 | ) |
|
92 | 26 | assert_routing( |
|
93 | 27 | { :method => 'get', :path => "/projects.atom" }, |
|
94 | 28 | { :controller => 'projects', :action => 'index', :format => 'atom' } |
|
95 | 29 | ) |
|
96 | 30 | assert_routing( |
|
97 | 31 | { :method => 'get', :path => "/projects.xml" }, |
|
98 | 32 | { :controller => 'projects', :action => 'index', :format => 'xml' } |
|
99 | 33 | ) |
|
100 | 34 | assert_routing( |
|
101 | 35 | { :method => 'get', :path => "/projects/new" }, |
|
102 | 36 | { :controller => 'projects', :action => 'new' } |
|
103 | 37 | ) |
|
104 | 38 | assert_routing( |
|
105 | 39 | { :method => 'get', :path => "/projects/test" }, |
|
106 | 40 | { :controller => 'projects', :action => 'show', :id => 'test' } |
|
107 | 41 | ) |
|
108 | 42 | assert_routing( |
|
109 | 43 | { :method => 'get', :path => "/projects/1.xml" }, |
|
110 | 44 | { :controller => 'projects', :action => 'show', :id => '1', |
|
111 | 45 | :format => 'xml' } |
|
112 | 46 | ) |
|
113 | 47 | assert_routing( |
|
114 | 48 | { :method => 'get', :path => "/projects/4223/settings" }, |
|
115 | 49 | { :controller => 'projects', :action => 'settings', :id => '4223' } |
|
116 | 50 | ) |
|
117 | 51 | assert_routing( |
|
118 | 52 | { :method => 'get', :path => "/projects/4223/settings/members" }, |
|
119 | 53 | { :controller => 'projects', :action => 'settings', :id => '4223', |
|
120 | 54 | :tab => 'members' } |
|
121 | 55 | ) |
|
122 | 56 | assert_routing( |
|
123 | 57 | { :method => 'post', :path => "/projects" }, |
|
124 | 58 | { :controller => 'projects', :action => 'create' } |
|
125 | 59 | ) |
|
126 | 60 | assert_routing( |
|
127 | 61 | { :method => 'post', :path => "/projects.xml" }, |
|
128 | 62 | { :controller => 'projects', :action => 'create', :format => 'xml' } |
|
129 | 63 | ) |
|
130 | 64 | assert_routing( |
|
131 | 65 | { :method => 'post', :path => "/projects/64/archive" }, |
|
132 | 66 | { :controller => 'projects', :action => 'archive', :id => '64' } |
|
133 | 67 | ) |
|
134 | 68 | assert_routing( |
|
135 | 69 | { :method => 'post', :path => "/projects/64/unarchive" }, |
|
136 | 70 | { :controller => 'projects', :action => 'unarchive', :id => '64' } |
|
137 | 71 | ) |
|
138 | 72 | assert_routing( |
|
139 | 73 | { :method => 'put', :path => "/projects/64/enumerations" }, |
|
140 | 74 | { :controller => 'project_enumerations', :action => 'update', |
|
141 | 75 | :project_id => '64' } |
|
142 | 76 | ) |
|
143 | 77 | assert_routing( |
|
144 | 78 | { :method => 'put', :path => "/projects/4223" }, |
|
145 | 79 | { :controller => 'projects', :action => 'update', :id => '4223' } |
|
146 | 80 | ) |
|
147 | 81 | assert_routing( |
|
148 | 82 | { :method => 'put', :path => "/projects/1.xml" }, |
|
149 | 83 | { :controller => 'projects', :action => 'update', :id => '1', |
|
150 | 84 | :format => 'xml' } |
|
151 | 85 | ) |
|
152 | 86 | assert_routing( |
|
153 | 87 | { :method => 'delete', :path => "/projects/64" }, |
|
154 | 88 | { :controller => 'projects', :action => 'destroy', :id => '64' } |
|
155 | 89 | ) |
|
156 | 90 | assert_routing( |
|
157 | 91 | { :method => 'delete', :path => "/projects/1.xml" }, |
|
158 | 92 | { :controller => 'projects', :action => 'destroy', :id => '1', |
|
159 | 93 | :format => 'xml' } |
|
160 | 94 | ) |
|
161 | 95 | assert_routing( |
|
162 | 96 | { :method => 'delete', :path => "/projects/64/enumerations" }, |
|
163 | 97 | { :controller => 'project_enumerations', :action => 'destroy', |
|
164 | 98 | :project_id => '64' } |
|
165 | 99 | ) |
|
166 | 100 | end |
|
167 | 101 | |
|
168 | 102 | def test_queries |
|
169 | 103 | assert_routing( |
|
170 | 104 | { :method => 'get', :path => "/queries.xml" }, |
|
171 | 105 | { :controller => 'queries', :action => 'index', :format => 'xml' } |
|
172 | 106 | ) |
|
173 | 107 | assert_routing( |
|
174 | 108 | { :method => 'get', :path => "/queries.json" }, |
|
175 | 109 | { :controller => 'queries', :action => 'index', :format => 'json' } |
|
176 | 110 | ) |
|
177 | 111 | assert_routing( |
|
178 | 112 | { :method => 'get', :path => "/queries/new" }, |
|
179 | 113 | { :controller => 'queries', :action => 'new' } |
|
180 | 114 | ) |
|
181 | 115 | assert_routing( |
|
182 | 116 | { :method => 'get', :path => "/projects/redmine/queries/new" }, |
|
183 | 117 | { :controller => 'queries', :action => 'new', :project_id => 'redmine' } |
|
184 | 118 | ) |
|
185 | 119 | assert_routing( |
|
186 | 120 | { :method => 'post', :path => "/queries" }, |
|
187 | 121 | { :controller => 'queries', :action => 'create' } |
|
188 | 122 | ) |
|
189 | 123 | assert_routing( |
|
190 | 124 | { :method => 'post', :path => "/projects/redmine/queries" }, |
|
191 | 125 | { :controller => 'queries', :action => 'create', :project_id => 'redmine' } |
|
192 | 126 | ) |
|
193 | 127 | assert_routing( |
|
194 | 128 | { :method => 'get', :path => "/queries/1/edit" }, |
|
195 | 129 | { :controller => 'queries', :action => 'edit', :id => '1' } |
|
196 | 130 | ) |
|
197 | 131 | assert_routing( |
|
198 | 132 | { :method => 'put', :path => "/queries/1" }, |
|
199 | 133 | { :controller => 'queries', :action => 'update', :id => '1' } |
|
200 | 134 | ) |
|
201 | 135 | assert_routing( |
|
202 | 136 | { :method => 'delete', :path => "/queries/1" }, |
|
203 | 137 | { :controller => 'queries', :action => 'destroy', :id => '1' } |
|
204 | 138 | ) |
|
205 | 139 | end |
|
206 | 140 | |
|
207 | 141 | def test_wiki_singular_projects_pages |
|
208 | 142 | assert_routing( |
|
209 | 143 | { :method => 'get', :path => "/projects/567/wiki" }, |
|
210 | 144 | { :controller => 'wiki', :action => 'show', :project_id => '567' } |
|
211 | 145 | ) |
|
212 | 146 | assert_routing( |
|
213 | 147 | { :method => 'get', :path => "/projects/567/wiki/lalala" }, |
|
214 | 148 | { :controller => 'wiki', :action => 'show', :project_id => '567', |
|
215 | 149 | :id => 'lalala' } |
|
216 | 150 | ) |
|
217 | 151 | assert_routing( |
|
218 | 152 | { :method => 'get', :path => "/projects/567/wiki/my_page/edit" }, |
|
219 | 153 | { :controller => 'wiki', :action => 'edit', :project_id => '567', |
|
220 | 154 | :id => 'my_page' } |
|
221 | 155 | ) |
|
222 | 156 | assert_routing( |
|
223 | 157 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/history" }, |
|
224 | 158 | { :controller => 'wiki', :action => 'history', :project_id => '1', |
|
225 | 159 | :id => 'CookBook_documentation' } |
|
226 | 160 | ) |
|
227 | 161 | assert_routing( |
|
228 | 162 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff" }, |
|
229 | 163 | { :controller => 'wiki', :action => 'diff', :project_id => '1', |
|
230 | 164 | :id => 'CookBook_documentation' } |
|
231 | 165 | ) |
|
232 | 166 | assert_routing( |
|
233 | 167 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2" }, |
|
234 | 168 | { :controller => 'wiki', :action => 'diff', :project_id => '1', |
|
235 | 169 | :id => 'CookBook_documentation', :version => '2' } |
|
236 | 170 | ) |
|
237 | 171 | assert_routing( |
|
238 | 172 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2/vs/1" }, |
|
239 | 173 | { :controller => 'wiki', :action => 'diff', :project_id => '1', |
|
240 | 174 | :id => 'CookBook_documentation', :version => '2', :version_from => '1' } |
|
241 | 175 | ) |
|
242 | 176 | assert_routing( |
|
243 | 177 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/annotate/2" }, |
|
244 | 178 | { :controller => 'wiki', :action => 'annotate', :project_id => '1', |
|
245 | 179 | :id => 'CookBook_documentation', :version => '2' } |
|
246 | 180 | ) |
|
247 | 181 | assert_routing( |
|
248 | 182 | { :method => 'get', :path => "/projects/22/wiki/ladida/rename" }, |
|
249 | 183 | { :controller => 'wiki', :action => 'rename', :project_id => '22', |
|
250 | 184 | :id => 'ladida' } |
|
251 | 185 | ) |
|
252 | 186 | assert_routing( |
|
253 | 187 | { :method => 'get', :path => "/projects/567/wiki/index" }, |
|
254 | 188 | { :controller => 'wiki', :action => 'index', :project_id => '567' } |
|
255 | 189 | ) |
|
256 | 190 | assert_routing( |
|
257 | 191 | { :method => 'get', :path => "/projects/567/wiki/date_index" }, |
|
258 | 192 | { :controller => 'wiki', :action => 'date_index', :project_id => '567' } |
|
259 | 193 | ) |
|
260 | 194 | assert_routing( |
|
261 | 195 | { :method => 'get', :path => "/projects/567/wiki/export" }, |
|
262 | 196 | { :controller => 'wiki', :action => 'export', :project_id => '567' } |
|
263 | 197 | ) |
|
264 | 198 | assert_routing( |
|
265 | 199 | { :method => 'post', :path => "/projects/567/wiki/CookBook_documentation/preview" }, |
|
266 | 200 | { :controller => 'wiki', :action => 'preview', :project_id => '567', |
|
267 | 201 | :id => 'CookBook_documentation' } |
|
268 | 202 | ) |
|
269 | 203 | assert_routing( |
|
270 | 204 | { :method => 'post', :path => "/projects/22/wiki/ladida/rename" }, |
|
271 | 205 | { :controller => 'wiki', :action => 'rename', :project_id => '22', |
|
272 | 206 | :id => 'ladida' } |
|
273 | 207 | ) |
|
274 | 208 | assert_routing( |
|
275 | 209 | { :method => 'post', :path => "/projects/22/wiki/ladida/protect" }, |
|
276 | 210 | { :controller => 'wiki', :action => 'protect', :project_id => '22', |
|
277 | 211 | :id => 'ladida' } |
|
278 | 212 | ) |
|
279 | 213 | assert_routing( |
|
280 | 214 | { :method => 'post', :path => "/projects/22/wiki/ladida/add_attachment" }, |
|
281 | 215 | { :controller => 'wiki', :action => 'add_attachment', :project_id => '22', |
|
282 | 216 | :id => 'ladida' } |
|
283 | 217 | ) |
|
284 | 218 | assert_routing( |
|
285 | 219 | { :method => 'put', :path => "/projects/567/wiki/my_page" }, |
|
286 | 220 | { :controller => 'wiki', :action => 'update', :project_id => '567', |
|
287 | 221 | :id => 'my_page' } |
|
288 | 222 | ) |
|
289 | 223 | assert_routing( |
|
290 | 224 | { :method => 'delete', :path => "/projects/22/wiki/ladida" }, |
|
291 | 225 | { :controller => 'wiki', :action => 'destroy', :project_id => '22', |
|
292 | 226 | :id => 'ladida' } |
|
293 | 227 | ) |
|
294 | 228 | end |
|
295 | 229 | |
|
296 | 230 | def test_wikis_plural_admin_setup |
|
297 | 231 | assert_routing( |
|
298 | 232 | { :method => 'get', :path => "/projects/ladida/wiki/destroy" }, |
|
299 | 233 | { :controller => 'wikis', :action => 'destroy', :id => 'ladida' } |
|
300 | 234 | ) |
|
301 | 235 | assert_routing( |
|
302 | 236 | { :method => 'post', :path => "/projects/ladida/wiki" }, |
|
303 | 237 | { :controller => 'wikis', :action => 'edit', :id => 'ladida' } |
|
304 | 238 | ) |
|
305 | 239 | assert_routing( |
|
306 | 240 | { :method => 'post', :path => "/projects/ladida/wiki/destroy" }, |
|
307 | 241 | { :controller => 'wikis', :action => 'destroy', :id => 'ladida' } |
|
308 | 242 | ) |
|
309 | 243 | end |
|
310 | 244 | end |
General Comments 0
You need to be logged in to leave comments.
Login now