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