@@ -0,0 +1,126 | |||
|
1 | # Redmine - project management software | |
|
2 | # Copyright (C) 2006-2011 Jean-Philippe Lang | |
|
3 | # | |
|
4 | # This program is free software; you can redistribute it and/or | |
|
5 | # modify it under the terms of the GNU General Public License | |
|
6 | # as published by the Free Software Foundation; either version 2 | |
|
7 | # of the License, or (at your option) any later version. | |
|
8 | # | |
|
9 | # This program is distributed in the hope that it will be useful, | |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
|
12 | # GNU General Public License for more details. | |
|
13 | # | |
|
14 | # You should have received a copy of the GNU General Public License | |
|
15 | # along with this program; if not, write to the Free Software | |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
|
17 | ||
|
18 | require File.expand_path('../../../test_helper', __FILE__) | |
|
19 | ||
|
20 | class RoutingIssuesTest < ActionController::IntegrationTest | |
|
21 | def test_issues_rest_actions | |
|
22 | assert_routing( | |
|
23 | { :method => 'get', :path => "/issues" }, | |
|
24 | { :controller => 'issues', :action => 'index' } | |
|
25 | ) | |
|
26 | assert_routing( | |
|
27 | { :method => 'get', :path => "/issues.pdf" }, | |
|
28 | { :controller => 'issues', :action => 'index', :format => 'pdf' } | |
|
29 | ) | |
|
30 | assert_routing( | |
|
31 | { :method => 'get', :path => "/issues.atom" }, | |
|
32 | { :controller => 'issues', :action => 'index', :format => 'atom' } | |
|
33 | ) | |
|
34 | assert_routing( | |
|
35 | { :method => 'get', :path => "/issues.xml" }, | |
|
36 | { :controller => 'issues', :action => 'index', :format => 'xml' } | |
|
37 | ) | |
|
38 | assert_routing( | |
|
39 | { :method => 'get', :path => "/projects/23/issues" }, | |
|
40 | { :controller => 'issues', :action => 'index', :project_id => '23' } | |
|
41 | ) | |
|
42 | assert_routing( | |
|
43 | { :method => 'get', :path => "/projects/23/issues.pdf" }, | |
|
44 | { :controller => 'issues', :action => 'index', :project_id => '23', | |
|
45 | :format => 'pdf' } | |
|
46 | ) | |
|
47 | assert_routing( | |
|
48 | { :method => 'get', :path => "/projects/23/issues.atom" }, | |
|
49 | { :controller => 'issues', :action => 'index', :project_id => '23', | |
|
50 | :format => 'atom' } | |
|
51 | ) | |
|
52 | assert_routing( | |
|
53 | { :method => 'get', :path => "/projects/23/issues.xml" }, | |
|
54 | { :controller => 'issues', :action => 'index', :project_id => '23', | |
|
55 | :format => 'xml' } | |
|
56 | ) | |
|
57 | assert_routing( | |
|
58 | { :method => 'get', :path => "/issues/64" }, | |
|
59 | { :controller => 'issues', :action => 'show', :id => '64' } | |
|
60 | ) | |
|
61 | assert_routing( | |
|
62 | { :method => 'get', :path => "/issues/64.pdf" }, | |
|
63 | { :controller => 'issues', :action => 'show', :id => '64', | |
|
64 | :format => 'pdf' } | |
|
65 | ) | |
|
66 | assert_routing( | |
|
67 | { :method => 'get', :path => "/issues/64.atom" }, | |
|
68 | { :controller => 'issues', :action => 'show', :id => '64', | |
|
69 | :format => 'atom' } | |
|
70 | ) | |
|
71 | assert_routing( | |
|
72 | { :method => 'get', :path => "/issues/64.xml" }, | |
|
73 | { :controller => 'issues', :action => 'show', :id => '64', | |
|
74 | :format => 'xml' } | |
|
75 | ) | |
|
76 | assert_routing( | |
|
77 | { :method => 'get', :path => "/projects/23/issues/new" }, | |
|
78 | { :controller => 'issues', :action => 'new', :project_id => '23' } | |
|
79 | ) | |
|
80 | end | |
|
81 | ||
|
82 | def test_issues_form_update | |
|
83 | assert_routing( | |
|
84 | { :method => 'post', :path => "/projects/23/issues/new" }, | |
|
85 | { :controller => 'issues', :action => 'new', :project_id => '23' } | |
|
86 | ) | |
|
87 | assert_routing( | |
|
88 | { :method => 'post', :path => "/projects/23/issues" }, | |
|
89 | { :controller => 'issues', :action => 'create', :project_id => '23' } | |
|
90 | ) | |
|
91 | assert_routing( | |
|
92 | { :method => 'post', :path => "/issues.xml" }, | |
|
93 | { :controller => 'issues', :action => 'create', :format => 'xml' } | |
|
94 | ) | |
|
95 | assert_routing( | |
|
96 | { :method => 'get', :path => "/issues/64/edit" }, | |
|
97 | { :controller => 'issues', :action => 'edit', :id => '64' } | |
|
98 | ) | |
|
99 | assert_routing( | |
|
100 | { :method => 'put', :path => "/issues/1.xml" }, | |
|
101 | { :controller => 'issues', :action => 'update', :id => '1', | |
|
102 | :format => 'xml' } | |
|
103 | ) | |
|
104 | assert_routing( | |
|
105 | { :method => 'delete', :path => "/issues/1.xml" }, | |
|
106 | { :controller => 'issues', :action => 'destroy', :id => '1', | |
|
107 | :format => 'xml' } | |
|
108 | ) | |
|
109 | end | |
|
110 | ||
|
111 | def test_issues_extra_actions | |
|
112 | assert_routing( | |
|
113 | { :method => 'get', :path => "/projects/23/issues/64/copy" }, | |
|
114 | { :controller => 'issues', :action => 'new', :project_id => '23', | |
|
115 | :copy_from => '64' } | |
|
116 | ) | |
|
117 | assert_routing( | |
|
118 | { :method => 'get', :path => "/issues/bulk_edit" }, | |
|
119 | { :controller => 'issues', :action => 'bulk_edit' } | |
|
120 | ) | |
|
121 | assert_routing( | |
|
122 | { :method => 'post', :path => "/issues/bulk_update" }, | |
|
123 | { :controller => 'issues', :action => 'bulk_update' } | |
|
124 | ) | |
|
125 | end | |
|
126 | end |
@@ -1,509 +1,403 | |||
|
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_issues_rest_actions | |
|
22 | assert_routing( | |
|
23 | { :method => 'get', :path => "/issues" }, | |
|
24 | { :controller => 'issues', :action => 'index' } | |
|
25 | ) | |
|
26 | assert_routing( | |
|
27 | { :method => 'get', :path => "/issues.pdf" }, | |
|
28 | { :controller => 'issues', :action => 'index', :format => 'pdf' } | |
|
29 | ) | |
|
30 | assert_routing( | |
|
31 | { :method => 'get', :path => "/issues.atom" }, | |
|
32 | { :controller => 'issues', :action => 'index', :format => 'atom' } | |
|
33 | ) | |
|
34 | assert_routing( | |
|
35 | { :method => 'get', :path => "/issues.xml" }, | |
|
36 | { :controller => 'issues', :action => 'index', :format => 'xml' } | |
|
37 | ) | |
|
38 | assert_routing( | |
|
39 | { :method => 'get', :path => "/projects/23/issues" }, | |
|
40 | { :controller => 'issues', :action => 'index', :project_id => '23' } | |
|
41 | ) | |
|
42 | assert_routing( | |
|
43 | { :method => 'get', :path => "/projects/23/issues.pdf" }, | |
|
44 | { :controller => 'issues', :action => 'index', :project_id => '23', | |
|
45 | :format => 'pdf' } | |
|
46 | ) | |
|
47 | assert_routing( | |
|
48 | { :method => 'get', :path => "/projects/23/issues.atom" }, | |
|
49 | { :controller => 'issues', :action => 'index', :project_id => '23', | |
|
50 | :format => 'atom' } | |
|
51 | ) | |
|
52 | assert_routing( | |
|
53 | { :method => 'get', :path => "/projects/23/issues.xml" }, | |
|
54 | { :controller => 'issues', :action => 'index', :project_id => '23', | |
|
55 | :format => 'xml' } | |
|
56 | ) | |
|
57 | assert_routing( | |
|
58 | { :method => 'get', :path => "/issues/64" }, | |
|
59 | { :controller => 'issues', :action => 'show', :id => '64' } | |
|
60 | ) | |
|
61 | assert_routing( | |
|
62 | { :method => 'get', :path => "/issues/64.pdf" }, | |
|
63 | { :controller => 'issues', :action => 'show', :id => '64', | |
|
64 | :format => 'pdf' } | |
|
65 | ) | |
|
66 | assert_routing( | |
|
67 | { :method => 'get', :path => "/issues/64.atom" }, | |
|
68 | { :controller => 'issues', :action => 'show', :id => '64', | |
|
69 | :format => 'atom' } | |
|
70 | ) | |
|
71 | assert_routing( | |
|
72 | { :method => 'get', :path => "/issues/64.xml" }, | |
|
73 | { :controller => 'issues', :action => 'show', :id => '64', | |
|
74 | :format => 'xml' } | |
|
75 | ) | |
|
76 | assert_routing( | |
|
77 | { :method => 'get', :path => "/projects/23/issues/new" }, | |
|
78 | { :controller => 'issues', :action => 'new', :project_id => '23' } | |
|
79 | ) | |
|
80 | end | |
|
81 | ||
|
82 | def test_issues_form_update | |
|
83 | assert_routing( | |
|
84 | { :method => 'post', :path => "/projects/23/issues/new" }, | |
|
85 | { :controller => 'issues', :action => 'new', :project_id => '23' } | |
|
86 | ) | |
|
87 | assert_routing( | |
|
88 | { :method => 'post', :path => "/projects/23/issues" }, | |
|
89 | { :controller => 'issues', :action => 'create', :project_id => '23' } | |
|
90 | ) | |
|
91 | assert_routing( | |
|
92 | { :method => 'post', :path => "/issues.xml" }, | |
|
93 | { :controller => 'issues', :action => 'create', :format => 'xml' } | |
|
94 | ) | |
|
95 | assert_routing( | |
|
96 | { :method => 'get', :path => "/issues/64/edit" }, | |
|
97 | { :controller => 'issues', :action => 'edit', :id => '64' } | |
|
98 | ) | |
|
99 | assert_routing( | |
|
100 | { :method => 'put', :path => "/issues/1.xml" }, | |
|
101 | { :controller => 'issues', :action => 'update', :id => '1', | |
|
102 | :format => 'xml' } | |
|
103 | ) | |
|
104 | assert_routing( | |
|
105 | { :method => 'delete', :path => "/issues/1.xml" }, | |
|
106 | { :controller => 'issues', :action => 'destroy', :id => '1', | |
|
107 | :format => 'xml' } | |
|
108 | ) | |
|
109 | end | |
|
110 | ||
|
111 | def test_issues_extra_actions | |
|
112 | assert_routing( | |
|
113 | { :method => 'get', :path => "/projects/23/issues/64/copy" }, | |
|
114 | { :controller => 'issues', :action => 'new', :project_id => '23', | |
|
115 | :copy_from => '64' } | |
|
116 | ) | |
|
117 | assert_routing( | |
|
118 | { :method => 'get', :path => "/issues/bulk_edit" }, | |
|
119 | { :controller => 'issues', :action => 'bulk_edit' } | |
|
120 | ) | |
|
121 | assert_routing( | |
|
122 | { :method => 'post', :path => "/issues/bulk_update" }, | |
|
123 | { :controller => 'issues', :action => 'bulk_update' } | |
|
124 | ) | |
|
125 | end | |
|
126 | ||
|
127 | 21 | def test_issue_categories |
|
128 | 22 | assert_routing( |
|
129 | 23 | { :method => 'get', :path => "/projects/foo/issue_categories" }, |
|
130 | 24 | { :controller => 'issue_categories', :action => 'index', |
|
131 | 25 | :project_id => 'foo' } |
|
132 | 26 | ) |
|
133 | 27 | assert_routing( |
|
134 | 28 | { :method => 'get', :path => "/projects/foo/issue_categories.xml" }, |
|
135 | 29 | { :controller => 'issue_categories', :action => 'index', |
|
136 | 30 | :project_id => 'foo', :format => 'xml' } |
|
137 | 31 | ) |
|
138 | 32 | assert_routing( |
|
139 | 33 | { :method => 'get', :path => "/projects/foo/issue_categories.json" }, |
|
140 | 34 | { :controller => 'issue_categories', :action => 'index', |
|
141 | 35 | :project_id => 'foo', :format => 'json' } |
|
142 | 36 | ) |
|
143 | 37 | assert_routing( |
|
144 | 38 | { :method => 'get', :path => "/projects/foo/issue_categories/new" }, |
|
145 | 39 | { :controller => 'issue_categories', :action => 'new', |
|
146 | 40 | :project_id => 'foo' } |
|
147 | 41 | ) |
|
148 | 42 | assert_routing( |
|
149 | 43 | { :method => 'post', :path => "/projects/foo/issue_categories" }, |
|
150 | 44 | { :controller => 'issue_categories', :action => 'create', |
|
151 | 45 | :project_id => 'foo' } |
|
152 | 46 | ) |
|
153 | 47 | assert_routing( |
|
154 | 48 | { :method => 'post', :path => "/projects/foo/issue_categories.xml" }, |
|
155 | 49 | { :controller => 'issue_categories', :action => 'create', |
|
156 | 50 | :project_id => 'foo', :format => 'xml' } |
|
157 | 51 | ) |
|
158 | 52 | assert_routing( |
|
159 | 53 | { :method => 'post', :path => "/projects/foo/issue_categories.json" }, |
|
160 | 54 | { :controller => 'issue_categories', :action => 'create', |
|
161 | 55 | :project_id => 'foo', :format => 'json' } |
|
162 | 56 | ) |
|
163 | 57 | assert_routing( |
|
164 | 58 | { :method => 'get', :path => "/issue_categories/1" }, |
|
165 | 59 | { :controller => 'issue_categories', :action => 'show', :id => '1' } |
|
166 | 60 | ) |
|
167 | 61 | assert_routing( |
|
168 | 62 | { :method => 'get', :path => "/issue_categories/1.xml" }, |
|
169 | 63 | { :controller => 'issue_categories', :action => 'show', :id => '1', |
|
170 | 64 | :format => 'xml' } |
|
171 | 65 | ) |
|
172 | 66 | assert_routing( |
|
173 | 67 | { :method => 'get', :path => "/issue_categories/1.json" }, |
|
174 | 68 | { :controller => 'issue_categories', :action => 'show', :id => '1', |
|
175 | 69 | :format => 'json' } |
|
176 | 70 | ) |
|
177 | 71 | assert_routing( |
|
178 | 72 | { :method => 'get', :path => "/issue_categories/1/edit" }, |
|
179 | 73 | { :controller => 'issue_categories', :action => 'edit', :id => '1' } |
|
180 | 74 | ) |
|
181 | 75 | assert_routing( |
|
182 | 76 | { :method => 'put', :path => "/issue_categories/1" }, |
|
183 | 77 | { :controller => 'issue_categories', :action => 'update', :id => '1' } |
|
184 | 78 | ) |
|
185 | 79 | assert_routing( |
|
186 | 80 | { :method => 'put', :path => "/issue_categories/1.xml" }, |
|
187 | 81 | { :controller => 'issue_categories', :action => 'update', :id => '1', |
|
188 | 82 | :format => 'xml' } |
|
189 | 83 | ) |
|
190 | 84 | assert_routing( |
|
191 | 85 | { :method => 'put', :path => "/issue_categories/1.json" }, |
|
192 | 86 | { :controller => 'issue_categories', :action => 'update', :id => '1', |
|
193 | 87 | :format => 'json' } |
|
194 | 88 | ) |
|
195 | 89 | assert_routing( |
|
196 | 90 | { :method => 'delete', :path => "/issue_categories/1" }, |
|
197 | 91 | { :controller => 'issue_categories', :action => 'destroy', :id => '1' } |
|
198 | 92 | ) |
|
199 | 93 | assert_routing( |
|
200 | 94 | { :method => 'delete', :path => "/issue_categories/1.xml" }, |
|
201 | 95 | { :controller => 'issue_categories', :action => 'destroy', :id => '1', |
|
202 | 96 | :format => 'xml' } |
|
203 | 97 | ) |
|
204 | 98 | assert_routing( |
|
205 | 99 | { :method => 'delete', :path => "/issue_categories/1.json" }, |
|
206 | 100 | { :controller => 'issue_categories', :action => 'destroy', :id => '1', |
|
207 | 101 | :format => 'json' } |
|
208 | 102 | ) |
|
209 | 103 | end |
|
210 | 104 | |
|
211 | 105 | def test_news |
|
212 | 106 | assert_routing( |
|
213 | 107 | { :method => 'get', :path => "/news" }, |
|
214 | 108 | { :controller => 'news', :action => 'index' } |
|
215 | 109 | ) |
|
216 | 110 | assert_routing( |
|
217 | 111 | { :method => 'get', :path => "/news.atom" }, |
|
218 | 112 | { :controller => 'news', :action => 'index', :format => 'atom' } |
|
219 | 113 | ) |
|
220 | 114 | assert_routing( |
|
221 | 115 | { :method => 'get', :path => "/news.xml" }, |
|
222 | 116 | { :controller => 'news', :action => 'index', :format => 'xml' } |
|
223 | 117 | ) |
|
224 | 118 | assert_routing( |
|
225 | 119 | { :method => 'get', :path => "/news.json" }, |
|
226 | 120 | { :controller => 'news', :action => 'index', :format => 'json' } |
|
227 | 121 | ) |
|
228 | 122 | assert_routing( |
|
229 | 123 | { :method => 'get', :path => "/projects/567/news" }, |
|
230 | 124 | { :controller => 'news', :action => 'index', :project_id => '567' } |
|
231 | 125 | ) |
|
232 | 126 | assert_routing( |
|
233 | 127 | { :method => 'get', :path => "/projects/567/news.atom" }, |
|
234 | 128 | { :controller => 'news', :action => 'index', :format => 'atom', |
|
235 | 129 | :project_id => '567' } |
|
236 | 130 | ) |
|
237 | 131 | assert_routing( |
|
238 | 132 | { :method => 'get', :path => "/projects/567/news.xml" }, |
|
239 | 133 | { :controller => 'news', :action => 'index', :format => 'xml', |
|
240 | 134 | :project_id => '567' } |
|
241 | 135 | ) |
|
242 | 136 | assert_routing( |
|
243 | 137 | { :method => 'get', :path => "/projects/567/news.json" }, |
|
244 | 138 | { :controller => 'news', :action => 'index', :format => 'json', |
|
245 | 139 | :project_id => '567' } |
|
246 | 140 | ) |
|
247 | 141 | assert_routing( |
|
248 | 142 | { :method => 'get', :path => "/news/2" }, |
|
249 | 143 | { :controller => 'news', :action => 'show', :id => '2' } |
|
250 | 144 | ) |
|
251 | 145 | assert_routing( |
|
252 | 146 | { :method => 'get', :path => "/projects/567/news/new" }, |
|
253 | 147 | { :controller => 'news', :action => 'new', :project_id => '567' } |
|
254 | 148 | ) |
|
255 | 149 | assert_routing( |
|
256 | 150 | { :method => 'get', :path => "/news/234" }, |
|
257 | 151 | { :controller => 'news', :action => 'show', :id => '234' } |
|
258 | 152 | ) |
|
259 | 153 | assert_routing( |
|
260 | 154 | { :method => 'get', :path => "/news/567/edit" }, |
|
261 | 155 | { :controller => 'news', :action => 'edit', :id => '567' } |
|
262 | 156 | ) |
|
263 | 157 | assert_routing( |
|
264 | 158 | { :method => 'post', :path => "/projects/567/news" }, |
|
265 | 159 | { :controller => 'news', :action => 'create', :project_id => '567' } |
|
266 | 160 | ) |
|
267 | 161 | assert_routing( |
|
268 | 162 | { :method => 'post', :path => "/news/567/comments" }, |
|
269 | 163 | { :controller => 'comments', :action => 'create', :id => '567' } |
|
270 | 164 | ) |
|
271 | 165 | assert_routing( |
|
272 | 166 | { :method => 'put', :path => "/news/567" }, |
|
273 | 167 | { :controller => 'news', :action => 'update', :id => '567' } |
|
274 | 168 | ) |
|
275 | 169 | assert_routing( |
|
276 | 170 | { :method => 'delete', :path => "/news/567" }, |
|
277 | 171 | { :controller => 'news', :action => 'destroy', :id => '567' } |
|
278 | 172 | ) |
|
279 | 173 | assert_routing( |
|
280 | 174 | { :method => 'delete', :path => "/news/567/comments/15" }, |
|
281 | 175 | { :controller => 'comments', :action => 'destroy', :id => '567', |
|
282 | 176 | :comment_id => '15' } |
|
283 | 177 | ) |
|
284 | 178 | end |
|
285 | 179 | |
|
286 | 180 | def test_projects |
|
287 | 181 | assert_routing( |
|
288 | 182 | { :method => 'get', :path => "/projects" }, |
|
289 | 183 | { :controller => 'projects', :action => 'index' } |
|
290 | 184 | ) |
|
291 | 185 | assert_routing( |
|
292 | 186 | { :method => 'get', :path => "/projects.atom" }, |
|
293 | 187 | { :controller => 'projects', :action => 'index', :format => 'atom' } |
|
294 | 188 | ) |
|
295 | 189 | assert_routing( |
|
296 | 190 | { :method => 'get', :path => "/projects.xml" }, |
|
297 | 191 | { :controller => 'projects', :action => 'index', :format => 'xml' } |
|
298 | 192 | ) |
|
299 | 193 | assert_routing( |
|
300 | 194 | { :method => 'get', :path => "/projects/new" }, |
|
301 | 195 | { :controller => 'projects', :action => 'new' } |
|
302 | 196 | ) |
|
303 | 197 | assert_routing( |
|
304 | 198 | { :method => 'get', :path => "/projects/test" }, |
|
305 | 199 | { :controller => 'projects', :action => 'show', :id => 'test' } |
|
306 | 200 | ) |
|
307 | 201 | assert_routing( |
|
308 | 202 | { :method => 'get', :path => "/projects/1.xml" }, |
|
309 | 203 | { :controller => 'projects', :action => 'show', :id => '1', |
|
310 | 204 | :format => 'xml' } |
|
311 | 205 | ) |
|
312 | 206 | assert_routing( |
|
313 | 207 | { :method => 'get', :path => "/projects/4223/settings" }, |
|
314 | 208 | { :controller => 'projects', :action => 'settings', :id => '4223' } |
|
315 | 209 | ) |
|
316 | 210 | assert_routing( |
|
317 | 211 | { :method => 'get', :path => "/projects/4223/settings/members" }, |
|
318 | 212 | { :controller => 'projects', :action => 'settings', :id => '4223', |
|
319 | 213 | :tab => 'members' } |
|
320 | 214 | ) |
|
321 | 215 | assert_routing( |
|
322 | 216 | { :method => 'post', :path => "/projects" }, |
|
323 | 217 | { :controller => 'projects', :action => 'create' } |
|
324 | 218 | ) |
|
325 | 219 | assert_routing( |
|
326 | 220 | { :method => 'post', :path => "/projects.xml" }, |
|
327 | 221 | { :controller => 'projects', :action => 'create', :format => 'xml' } |
|
328 | 222 | ) |
|
329 | 223 | assert_routing( |
|
330 | 224 | { :method => 'post', :path => "/projects/64/archive" }, |
|
331 | 225 | { :controller => 'projects', :action => 'archive', :id => '64' } |
|
332 | 226 | ) |
|
333 | 227 | assert_routing( |
|
334 | 228 | { :method => 'post', :path => "/projects/64/unarchive" }, |
|
335 | 229 | { :controller => 'projects', :action => 'unarchive', :id => '64' } |
|
336 | 230 | ) |
|
337 | 231 | assert_routing( |
|
338 | 232 | { :method => 'put', :path => "/projects/64/enumerations" }, |
|
339 | 233 | { :controller => 'project_enumerations', :action => 'update', |
|
340 | 234 | :project_id => '64' } |
|
341 | 235 | ) |
|
342 | 236 | assert_routing( |
|
343 | 237 | { :method => 'put', :path => "/projects/4223" }, |
|
344 | 238 | { :controller => 'projects', :action => 'update', :id => '4223' } |
|
345 | 239 | ) |
|
346 | 240 | assert_routing( |
|
347 | 241 | { :method => 'put', :path => "/projects/1.xml" }, |
|
348 | 242 | { :controller => 'projects', :action => 'update', :id => '1', |
|
349 | 243 | :format => 'xml' } |
|
350 | 244 | ) |
|
351 | 245 | assert_routing( |
|
352 | 246 | { :method => 'delete', :path => "/projects/64" }, |
|
353 | 247 | { :controller => 'projects', :action => 'destroy', :id => '64' } |
|
354 | 248 | ) |
|
355 | 249 | assert_routing( |
|
356 | 250 | { :method => 'delete', :path => "/projects/1.xml" }, |
|
357 | 251 | { :controller => 'projects', :action => 'destroy', :id => '1', |
|
358 | 252 | :format => 'xml' } |
|
359 | 253 | ) |
|
360 | 254 | assert_routing( |
|
361 | 255 | { :method => 'delete', :path => "/projects/64/enumerations" }, |
|
362 | 256 | { :controller => 'project_enumerations', :action => 'destroy', |
|
363 | 257 | :project_id => '64' } |
|
364 | 258 | ) |
|
365 | 259 | end |
|
366 | 260 | |
|
367 | 261 | def test_queries |
|
368 | 262 | assert_routing( |
|
369 | 263 | { :method => 'get', :path => "/queries.xml" }, |
|
370 | 264 | { :controller => 'queries', :action => 'index', :format => 'xml' } |
|
371 | 265 | ) |
|
372 | 266 | assert_routing( |
|
373 | 267 | { :method => 'get', :path => "/queries.json" }, |
|
374 | 268 | { :controller => 'queries', :action => 'index', :format => 'json' } |
|
375 | 269 | ) |
|
376 | 270 | assert_routing( |
|
377 | 271 | { :method => 'get', :path => "/queries/new" }, |
|
378 | 272 | { :controller => 'queries', :action => 'new' } |
|
379 | 273 | ) |
|
380 | 274 | assert_routing( |
|
381 | 275 | { :method => 'get', :path => "/projects/redmine/queries/new" }, |
|
382 | 276 | { :controller => 'queries', :action => 'new', :project_id => 'redmine' } |
|
383 | 277 | ) |
|
384 | 278 | assert_routing( |
|
385 | 279 | { :method => 'post', :path => "/queries" }, |
|
386 | 280 | { :controller => 'queries', :action => 'create' } |
|
387 | 281 | ) |
|
388 | 282 | assert_routing( |
|
389 | 283 | { :method => 'post', :path => "/projects/redmine/queries" }, |
|
390 | 284 | { :controller => 'queries', :action => 'create', :project_id => 'redmine' } |
|
391 | 285 | ) |
|
392 | 286 | assert_routing( |
|
393 | 287 | { :method => 'get', :path => "/queries/1/edit" }, |
|
394 | 288 | { :controller => 'queries', :action => 'edit', :id => '1' } |
|
395 | 289 | ) |
|
396 | 290 | assert_routing( |
|
397 | 291 | { :method => 'put', :path => "/queries/1" }, |
|
398 | 292 | { :controller => 'queries', :action => 'update', :id => '1' } |
|
399 | 293 | ) |
|
400 | 294 | assert_routing( |
|
401 | 295 | { :method => 'delete', :path => "/queries/1" }, |
|
402 | 296 | { :controller => 'queries', :action => 'destroy', :id => '1' } |
|
403 | 297 | ) |
|
404 | 298 | end |
|
405 | 299 | |
|
406 | 300 | def test_wiki_singular_projects_pages |
|
407 | 301 | assert_routing( |
|
408 | 302 | { :method => 'get', :path => "/projects/567/wiki" }, |
|
409 | 303 | { :controller => 'wiki', :action => 'show', :project_id => '567' } |
|
410 | 304 | ) |
|
411 | 305 | assert_routing( |
|
412 | 306 | { :method => 'get', :path => "/projects/567/wiki/lalala" }, |
|
413 | 307 | { :controller => 'wiki', :action => 'show', :project_id => '567', |
|
414 | 308 | :id => 'lalala' } |
|
415 | 309 | ) |
|
416 | 310 | assert_routing( |
|
417 | 311 | { :method => 'get', :path => "/projects/567/wiki/my_page/edit" }, |
|
418 | 312 | { :controller => 'wiki', :action => 'edit', :project_id => '567', |
|
419 | 313 | :id => 'my_page' } |
|
420 | 314 | ) |
|
421 | 315 | assert_routing( |
|
422 | 316 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/history" }, |
|
423 | 317 | { :controller => 'wiki', :action => 'history', :project_id => '1', |
|
424 | 318 | :id => 'CookBook_documentation' } |
|
425 | 319 | ) |
|
426 | 320 | assert_routing( |
|
427 | 321 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff" }, |
|
428 | 322 | { :controller => 'wiki', :action => 'diff', :project_id => '1', |
|
429 | 323 | :id => 'CookBook_documentation' } |
|
430 | 324 | ) |
|
431 | 325 | assert_routing( |
|
432 | 326 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2" }, |
|
433 | 327 | { :controller => 'wiki', :action => 'diff', :project_id => '1', |
|
434 | 328 | :id => 'CookBook_documentation', :version => '2' } |
|
435 | 329 | ) |
|
436 | 330 | assert_routing( |
|
437 | 331 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2/vs/1" }, |
|
438 | 332 | { :controller => 'wiki', :action => 'diff', :project_id => '1', |
|
439 | 333 | :id => 'CookBook_documentation', :version => '2', :version_from => '1' } |
|
440 | 334 | ) |
|
441 | 335 | assert_routing( |
|
442 | 336 | { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/annotate/2" }, |
|
443 | 337 | { :controller => 'wiki', :action => 'annotate', :project_id => '1', |
|
444 | 338 | :id => 'CookBook_documentation', :version => '2' } |
|
445 | 339 | ) |
|
446 | 340 | assert_routing( |
|
447 | 341 | { :method => 'get', :path => "/projects/22/wiki/ladida/rename" }, |
|
448 | 342 | { :controller => 'wiki', :action => 'rename', :project_id => '22', |
|
449 | 343 | :id => 'ladida' } |
|
450 | 344 | ) |
|
451 | 345 | assert_routing( |
|
452 | 346 | { :method => 'get', :path => "/projects/567/wiki/index" }, |
|
453 | 347 | { :controller => 'wiki', :action => 'index', :project_id => '567' } |
|
454 | 348 | ) |
|
455 | 349 | assert_routing( |
|
456 | 350 | { :method => 'get', :path => "/projects/567/wiki/date_index" }, |
|
457 | 351 | { :controller => 'wiki', :action => 'date_index', :project_id => '567' } |
|
458 | 352 | ) |
|
459 | 353 | assert_routing( |
|
460 | 354 | { :method => 'get', :path => "/projects/567/wiki/export" }, |
|
461 | 355 | { :controller => 'wiki', :action => 'export', :project_id => '567' } |
|
462 | 356 | ) |
|
463 | 357 | assert_routing( |
|
464 | 358 | { :method => 'post', :path => "/projects/567/wiki/CookBook_documentation/preview" }, |
|
465 | 359 | { :controller => 'wiki', :action => 'preview', :project_id => '567', |
|
466 | 360 | :id => 'CookBook_documentation' } |
|
467 | 361 | ) |
|
468 | 362 | assert_routing( |
|
469 | 363 | { :method => 'post', :path => "/projects/22/wiki/ladida/rename" }, |
|
470 | 364 | { :controller => 'wiki', :action => 'rename', :project_id => '22', |
|
471 | 365 | :id => 'ladida' } |
|
472 | 366 | ) |
|
473 | 367 | assert_routing( |
|
474 | 368 | { :method => 'post', :path => "/projects/22/wiki/ladida/protect" }, |
|
475 | 369 | { :controller => 'wiki', :action => 'protect', :project_id => '22', |
|
476 | 370 | :id => 'ladida' } |
|
477 | 371 | ) |
|
478 | 372 | assert_routing( |
|
479 | 373 | { :method => 'post', :path => "/projects/22/wiki/ladida/add_attachment" }, |
|
480 | 374 | { :controller => 'wiki', :action => 'add_attachment', :project_id => '22', |
|
481 | 375 | :id => 'ladida' } |
|
482 | 376 | ) |
|
483 | 377 | assert_routing( |
|
484 | 378 | { :method => 'put', :path => "/projects/567/wiki/my_page" }, |
|
485 | 379 | { :controller => 'wiki', :action => 'update', :project_id => '567', |
|
486 | 380 | :id => 'my_page' } |
|
487 | 381 | ) |
|
488 | 382 | assert_routing( |
|
489 | 383 | { :method => 'delete', :path => "/projects/22/wiki/ladida" }, |
|
490 | 384 | { :controller => 'wiki', :action => 'destroy', :project_id => '22', |
|
491 | 385 | :id => 'ladida' } |
|
492 | 386 | ) |
|
493 | 387 | end |
|
494 | 388 | |
|
495 | 389 | def test_wikis_plural_admin_setup |
|
496 | 390 | assert_routing( |
|
497 | 391 | { :method => 'get', :path => "/projects/ladida/wiki/destroy" }, |
|
498 | 392 | { :controller => 'wikis', :action => 'destroy', :id => 'ladida' } |
|
499 | 393 | ) |
|
500 | 394 | assert_routing( |
|
501 | 395 | { :method => 'post', :path => "/projects/ladida/wiki" }, |
|
502 | 396 | { :controller => 'wikis', :action => 'edit', :id => 'ladida' } |
|
503 | 397 | ) |
|
504 | 398 | assert_routing( |
|
505 | 399 | { :method => 'post', :path => "/projects/ladida/wiki/destroy" }, |
|
506 | 400 | { :controller => 'wikis', :action => 'destroy', :id => 'ladida' } |
|
507 | 401 | ) |
|
508 | 402 | end |
|
509 | 403 | end |
General Comments 0
You need to be logged in to leave comments.
Login now