@@ -1,409 +1,411 | |||||
1 | # Redmine - project management software |
|
1 | # Redmine - project management software | |
2 | # Copyright (C) 2006-2012 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2012 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
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 |
|
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. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | require File.expand_path('../../../test_helper', __FILE__) |
|
18 | require File.expand_path('../../../test_helper', __FILE__) | |
19 |
|
19 | |||
20 | class RoutingRepositoriesTest < ActionController::IntegrationTest |
|
20 | class RoutingRepositoriesTest < ActionController::IntegrationTest | |
21 | def setup |
|
21 | def setup | |
22 | @path_hash = repository_path_hash(%w[path to file.c]) |
|
22 | @path_hash = repository_path_hash(%w[path to file.c]) | |
23 | assert_equal "path/to/file.c", @path_hash[:path] |
|
23 | assert_equal "path/to/file.c", @path_hash[:path] | |
24 | assert_equal "path/to/file.c", @path_hash[:param] |
|
24 | assert_equal "path/to/file.c", @path_hash[:param] | |
25 | end |
|
25 | end | |
26 |
|
26 | |||
27 | def test_repositories_resources |
|
27 | def test_repositories_resources | |
28 | assert_routing( |
|
28 | assert_routing( | |
29 | { :method => 'get', |
|
29 | { :method => 'get', | |
30 | :path => "/projects/redmine/repositories/new" }, |
|
30 | :path => "/projects/redmine/repositories/new" }, | |
31 | { :controller => 'repositories', :action => 'new', :project_id => 'redmine' } |
|
31 | { :controller => 'repositories', :action => 'new', :project_id => 'redmine' } | |
32 | ) |
|
32 | ) | |
33 | assert_routing( |
|
33 | assert_routing( | |
34 | { :method => 'post', |
|
34 | { :method => 'post', | |
35 | :path => "/projects/redmine/repositories" }, |
|
35 | :path => "/projects/redmine/repositories" }, | |
36 | { :controller => 'repositories', :action => 'create', :project_id => 'redmine' } |
|
36 | { :controller => 'repositories', :action => 'create', :project_id => 'redmine' } | |
37 | ) |
|
37 | ) | |
38 | assert_routing( |
|
38 | assert_routing( | |
39 | { :method => 'get', |
|
39 | { :method => 'get', | |
40 | :path => "/repositories/1/edit" }, |
|
40 | :path => "/repositories/1/edit" }, | |
41 | { :controller => 'repositories', :action => 'edit', :id => '1' } |
|
41 | { :controller => 'repositories', :action => 'edit', :id => '1' } | |
42 | ) |
|
42 | ) | |
43 | assert_routing( |
|
43 | assert_routing( | |
44 | { :method => 'put', |
|
44 | { :method => 'put', | |
45 | :path => "/repositories/1" }, |
|
45 | :path => "/repositories/1" }, | |
46 | { :controller => 'repositories', :action => 'update', :id => '1' } |
|
46 | { :controller => 'repositories', :action => 'update', :id => '1' } | |
47 | ) |
|
47 | ) | |
48 | assert_routing( |
|
48 | assert_routing( | |
49 | { :method => 'delete', |
|
49 | { :method => 'delete', | |
50 | :path => "/repositories/1" }, |
|
50 | :path => "/repositories/1" }, | |
51 | { :controller => 'repositories', :action => 'destroy', :id => '1' } |
|
51 | { :controller => 'repositories', :action => 'destroy', :id => '1' } | |
52 | ) |
|
52 | ) | |
53 | ["get", "post"].each do |method| |
|
53 | ["get", "post"].each do |method| | |
54 | assert_routing( |
|
54 | assert_routing( | |
55 | { :method => method, |
|
55 | { :method => method, | |
56 | :path => "/repositories/1/committers" }, |
|
56 | :path => "/repositories/1/committers" }, | |
57 | { :controller => 'repositories', :action => 'committers', :id => '1' } |
|
57 | { :controller => 'repositories', :action => 'committers', :id => '1' } | |
58 | ) |
|
58 | ) | |
59 | end |
|
59 | end | |
60 | end |
|
60 | end | |
61 |
|
61 | |||
62 | def test_repositories_show |
|
62 | def test_repositories_show | |
63 | assert_routing( |
|
63 | assert_routing( | |
64 | { :method => 'get', |
|
64 | { :method => 'get', | |
65 | :path => "/projects/redmine/repository" }, |
|
65 | :path => "/projects/redmine/repository" }, | |
66 | { :controller => 'repositories', :action => 'show', :id => 'redmine' } |
|
66 | { :controller => 'repositories', :action => 'show', :id => 'redmine' } | |
67 | ) |
|
67 | ) | |
68 | end |
|
68 | end | |
69 |
|
69 | |||
70 | def test_repositories |
|
70 | def test_repositories | |
71 | assert_routing( |
|
71 | assert_routing( | |
72 | { :method => 'get', |
|
72 | { :method => 'get', | |
73 | :path => "/projects/redmine/repository/statistics" }, |
|
73 | :path => "/projects/redmine/repository/statistics" }, | |
74 | { :controller => 'repositories', :action => 'stats', :id => 'redmine' } |
|
74 | { :controller => 'repositories', :action => 'stats', :id => 'redmine' } | |
75 | ) |
|
75 | ) | |
76 | assert_routing( |
|
76 | assert_routing( | |
77 | { :method => 'get', |
|
77 | { :method => 'get', | |
78 | :path => "/projects/redmine/repository/graph" }, |
|
78 | :path => "/projects/redmine/repository/graph" }, | |
79 | { :controller => 'repositories', :action => 'graph', :id => 'redmine' } |
|
79 | { :controller => 'repositories', :action => 'graph', :id => 'redmine' } | |
80 | ) |
|
80 | ) | |
81 | end |
|
81 | end | |
82 |
|
82 | |||
83 | def test_repositories_show_with_repository_id |
|
83 | def test_repositories_show_with_repository_id | |
84 | assert_routing( |
|
84 | assert_routing( | |
85 | { :method => 'get', |
|
85 | { :method => 'get', | |
86 | :path => "/projects/redmine/repository/foo" }, |
|
86 | :path => "/projects/redmine/repository/foo" }, | |
87 | { :controller => 'repositories', :action => 'show', :id => 'redmine', :repository_id => 'foo' } |
|
87 | { :controller => 'repositories', :action => 'show', :id => 'redmine', :repository_id => 'foo' } | |
88 | ) |
|
88 | ) | |
89 | end |
|
89 | end | |
90 |
|
90 | |||
91 | def test_repositories_with_repository_id |
|
91 | def test_repositories_with_repository_id | |
92 | assert_routing( |
|
92 | assert_routing( | |
93 | { :method => 'get', |
|
93 | { :method => 'get', | |
94 | :path => "/projects/redmine/repository/foo/statistics" }, |
|
94 | :path => "/projects/redmine/repository/foo/statistics" }, | |
95 | { :controller => 'repositories', :action => 'stats', :id => 'redmine', :repository_id => 'foo' } |
|
95 | { :controller => 'repositories', :action => 'stats', :id => 'redmine', :repository_id => 'foo' } | |
96 | ) |
|
96 | ) | |
97 | assert_routing( |
|
97 | assert_routing( | |
98 | { :method => 'get', |
|
98 | { :method => 'get', | |
99 | :path => "/projects/redmine/repository/foo/graph" }, |
|
99 | :path => "/projects/redmine/repository/foo/graph" }, | |
100 | { :controller => 'repositories', :action => 'graph', :id => 'redmine', :repository_id => 'foo' } |
|
100 | { :controller => 'repositories', :action => 'graph', :id => 'redmine', :repository_id => 'foo' } | |
101 | ) |
|
101 | ) | |
102 | end |
|
102 | end | |
103 |
|
103 | |||
104 | def test_repositories_revisions |
|
104 | def test_repositories_revisions | |
105 | empty_path_param = [] |
|
105 | empty_path_param = [] | |
106 | assert_routing( |
|
106 | assert_routing( | |
107 | { :method => 'get', |
|
107 | { :method => 'get', | |
108 | :path => "/projects/redmine/repository/revisions" }, |
|
108 | :path => "/projects/redmine/repository/revisions" }, | |
109 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine' } |
|
109 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine' } | |
110 | ) |
|
110 | ) | |
111 | assert_routing( |
|
111 | assert_routing( | |
112 | { :method => 'get', |
|
112 | { :method => 'get', | |
113 | :path => "/projects/redmine/repository/revisions.atom" }, |
|
113 | :path => "/projects/redmine/repository/revisions.atom" }, | |
114 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine', |
|
114 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine', | |
115 | :format => 'atom' } |
|
115 | :format => 'atom' } | |
116 | ) |
|
116 | ) | |
117 | assert_routing( |
|
117 | assert_routing( | |
118 | { :method => 'get', |
|
118 | { :method => 'get', | |
119 | :path => "/projects/redmine/repository/revisions/2457" }, |
|
119 | :path => "/projects/redmine/repository/revisions/2457" }, | |
120 | { :controller => 'repositories', :action => 'revision', :id => 'redmine', |
|
120 | { :controller => 'repositories', :action => 'revision', :id => 'redmine', | |
121 | :rev => '2457' } |
|
121 | :rev => '2457' } | |
122 | ) |
|
122 | ) | |
123 | assert_routing( |
|
123 | assert_routing( | |
124 | { :method => 'get', |
|
124 | { :method => 'get', | |
125 | :path => "/projects/redmine/repository/revisions/2457/show" }, |
|
125 | :path => "/projects/redmine/repository/revisions/2457/show" }, | |
126 | { :controller => 'repositories', :action => 'show', :id => 'redmine', |
|
126 | { :controller => 'repositories', :action => 'show', :id => 'redmine', | |
127 | :rev => '2457' } |
|
127 | :rev => '2457' } | |
128 | ) |
|
128 | ) | |
129 | assert_routing( |
|
129 | assert_routing( | |
130 | { :method => 'get', |
|
130 | { :method => 'get', | |
131 | :path => "/projects/redmine/repository/revisions/2457/show/#{@path_hash[:path]}" }, |
|
131 | :path => "/projects/redmine/repository/revisions/2457/show/#{@path_hash[:path]}" }, | |
132 | { :controller => 'repositories', :action => 'show', :id => 'redmine', |
|
132 | { :controller => 'repositories', :action => 'show', :id => 'redmine', | |
133 | :path => @path_hash[:param] , :rev => '2457'} |
|
133 | :path => @path_hash[:param] , :rev => '2457'} | |
134 | ) |
|
134 | ) | |
135 | assert_routing( |
|
135 | assert_routing( | |
136 | { :method => 'get', |
|
136 | { :method => 'get', | |
137 | :path => "/projects/redmine/repository/changes" }, |
|
|||
138 | { :controller => 'repositories', :action => 'changes', :id => 'redmine' } |
|
|||
139 | ) |
|
|||
140 | ['2457', 'master', 'slash/slash'].each do |rev| |
|
|||
141 | assert_routing( |
|
|||
142 | { :method => 'get', |
|
|||
143 | :path => "/projects/redmine/repository/changes" }, |
|
|||
144 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', |
|
|||
145 | :rev => rev }, |
|
|||
146 | {}, |
|
|||
147 | { :rev => rev } |
|
|||
148 | ) |
|
|||
149 | end |
|
|||
150 | ['2457', 'master', 'slash/slash'].each do |rev| |
|
|||
151 | assert_routing( |
|
|||
152 | { :method => 'get', |
|
|||
153 | :path => "/projects/redmine/repository/changes/#{@path_hash[:path]}" }, |
|
|||
154 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', |
|
|||
155 | :path => @path_hash[:param], :rev => rev }, |
|
|||
156 | {}, |
|
|||
157 | { :rev => rev } |
|
|||
158 | ) |
|
|||
159 | end |
|
|||
160 | assert_routing( |
|
|||
161 | { :method => 'get', |
|
|||
162 | :path => "/projects/redmine/repository/revisions/2457/diff" }, |
|
137 | :path => "/projects/redmine/repository/revisions/2457/diff" }, | |
163 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', |
|
138 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', | |
164 | :rev => '2457' } |
|
139 | :rev => '2457' } | |
165 | ) |
|
140 | ) | |
166 | assert_routing( |
|
141 | assert_routing( | |
167 | { :method => 'get', |
|
142 | { :method => 'get', | |
168 | :path => "/projects/redmine/repository/revisions/2457/diff.diff" }, |
|
143 | :path => "/projects/redmine/repository/revisions/2457/diff.diff" }, | |
169 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', |
|
144 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', | |
170 | :rev => '2457', :format => 'diff' } |
|
145 | :rev => '2457', :format => 'diff' } | |
171 | ) |
|
146 | ) | |
172 | assert_routing( |
|
147 | assert_routing( | |
173 | { :method => 'get', |
|
148 | { :method => 'get', | |
174 | :path => "/projects/redmine/repository/revisions/2/diff/#{@path_hash[:path]}" }, |
|
149 | :path => "/projects/redmine/repository/revisions/2/diff/#{@path_hash[:path]}" }, | |
175 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', |
|
150 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', | |
176 | :path => @path_hash[:param], :rev => '2' } |
|
151 | :path => @path_hash[:param], :rev => '2' } | |
177 | ) |
|
152 | ) | |
178 | assert_routing( |
|
153 | assert_routing( | |
179 | { :method => 'get', |
|
154 | { :method => 'get', | |
180 | :path => "/projects/redmine/repository/revisions/2/entry/#{@path_hash[:path]}" }, |
|
155 | :path => "/projects/redmine/repository/revisions/2/entry/#{@path_hash[:path]}" }, | |
181 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', |
|
156 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', | |
182 | :path => @path_hash[:param], :rev => '2' } |
|
157 | :path => @path_hash[:param], :rev => '2' } | |
183 | ) |
|
158 | ) | |
184 | assert_routing( |
|
159 | assert_routing( | |
185 | { :method => 'get', |
|
160 | { :method => 'get', | |
186 | :path => "/projects/redmine/repository/revisions/2/raw/#{@path_hash[:path]}" }, |
|
161 | :path => "/projects/redmine/repository/revisions/2/raw/#{@path_hash[:path]}" }, | |
187 | { :controller => 'repositories', :action => 'raw', :id => 'redmine', |
|
162 | { :controller => 'repositories', :action => 'raw', :id => 'redmine', | |
188 | :path => @path_hash[:param], :rev => '2' } |
|
163 | :path => @path_hash[:param], :rev => '2' } | |
189 | ) |
|
164 | ) | |
190 | assert_routing( |
|
165 | assert_routing( | |
191 | { :method => 'get', |
|
166 | { :method => 'get', | |
192 | :path => "/projects/redmine/repository/revisions/2/annotate/#{@path_hash[:path]}" }, |
|
167 | :path => "/projects/redmine/repository/revisions/2/annotate/#{@path_hash[:path]}" }, | |
193 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', |
|
168 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', | |
194 | :path => @path_hash[:param], :rev => '2' } |
|
169 | :path => @path_hash[:param], :rev => '2' } | |
195 | ) |
|
170 | ) | |
196 | end |
|
171 | end | |
197 |
|
172 | |||
198 | def test_repositories_revisions_with_repository_id |
|
173 | def test_repositories_revisions_with_repository_id | |
199 | empty_path_param = [] |
|
174 | empty_path_param = [] | |
200 | assert_routing( |
|
175 | assert_routing( | |
201 | { :method => 'get', |
|
176 | { :method => 'get', | |
202 | :path => "/projects/redmine/repository/foo/revisions" }, |
|
177 | :path => "/projects/redmine/repository/foo/revisions" }, | |
203 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine', :repository_id => 'foo' } |
|
178 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine', :repository_id => 'foo' } | |
204 | ) |
|
179 | ) | |
205 | assert_routing( |
|
180 | assert_routing( | |
206 | { :method => 'get', |
|
181 | { :method => 'get', | |
207 | :path => "/projects/redmine/repository/foo/revisions.atom" }, |
|
182 | :path => "/projects/redmine/repository/foo/revisions.atom" }, | |
208 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine', :repository_id => 'foo', |
|
183 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine', :repository_id => 'foo', | |
209 | :format => 'atom' } |
|
184 | :format => 'atom' } | |
210 | ) |
|
185 | ) | |
211 | assert_routing( |
|
186 | assert_routing( | |
212 | { :method => 'get', |
|
187 | { :method => 'get', | |
213 | :path => "/projects/redmine/repository/foo/revisions/2457" }, |
|
188 | :path => "/projects/redmine/repository/foo/revisions/2457" }, | |
214 | { :controller => 'repositories', :action => 'revision', :id => 'redmine', :repository_id => 'foo', |
|
189 | { :controller => 'repositories', :action => 'revision', :id => 'redmine', :repository_id => 'foo', | |
215 | :rev => '2457' } |
|
190 | :rev => '2457' } | |
216 | ) |
|
191 | ) | |
217 | assert_routing( |
|
192 | assert_routing( | |
218 | { :method => 'get', |
|
193 | { :method => 'get', | |
219 | :path => "/projects/redmine/repository/foo/revisions/2457/show" }, |
|
194 | :path => "/projects/redmine/repository/foo/revisions/2457/show" }, | |
220 | { :controller => 'repositories', :action => 'show', :id => 'redmine', :repository_id => 'foo', |
|
195 | { :controller => 'repositories', :action => 'show', :id => 'redmine', :repository_id => 'foo', | |
221 | :rev => '2457' } |
|
196 | :rev => '2457' } | |
222 | ) |
|
197 | ) | |
223 | assert_routing( |
|
198 | assert_routing( | |
224 | { :method => 'get', |
|
199 | { :method => 'get', | |
225 | :path => "/projects/redmine/repository/foo/revisions/2457/show/#{@path_hash[:path]}" }, |
|
200 | :path => "/projects/redmine/repository/foo/revisions/2457/show/#{@path_hash[:path]}" }, | |
226 | { :controller => 'repositories', :action => 'show', :id => 'redmine', :repository_id => 'foo', |
|
201 | { :controller => 'repositories', :action => 'show', :id => 'redmine', :repository_id => 'foo', | |
227 | :path => @path_hash[:param] , :rev => '2457'} |
|
202 | :path => @path_hash[:param] , :rev => '2457'} | |
228 | ) |
|
203 | ) | |
229 | assert_routing( |
|
204 | assert_routing( | |
230 | { :method => 'get', |
|
205 | { :method => 'get', | |
231 | :path => "/projects/redmine/repository/foo/changes" }, |
|
|||
232 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', :repository_id => 'foo' } |
|
|||
233 | ) |
|
|||
234 | ['2457', 'master', 'slash/slash'].each do |rev| |
|
|||
235 | assert_routing( |
|
|||
236 | { :method => 'get', |
|
|||
237 | :path => "/projects/redmine/repository/foo/changes" }, |
|
|||
238 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', |
|
|||
239 | :repository_id => 'foo', :rev => rev }, |
|
|||
240 | {}, |
|
|||
241 | { :rev => rev } |
|
|||
242 | ) |
|
|||
243 | end |
|
|||
244 | ['2457', 'master', 'slash/slash'].each do |rev| |
|
|||
245 | assert_routing( |
|
|||
246 | { :method => 'get', |
|
|||
247 | :path => "/projects/redmine/repository/foo/changes/#{@path_hash[:path]}" }, |
|
|||
248 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', |
|
|||
249 | :repository_id => 'foo', :path => @path_hash[:param], :rev => rev }, |
|
|||
250 | {}, |
|
|||
251 | { :rev => rev } |
|
|||
252 | ) |
|
|||
253 | end |
|
|||
254 | assert_routing( |
|
|||
255 | { :method => 'get', |
|
|||
256 | :path => "/projects/redmine/repository/foo/revisions/2457/diff" }, |
|
206 | :path => "/projects/redmine/repository/foo/revisions/2457/diff" }, | |
257 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', |
|
207 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', | |
258 | :rev => '2457' } |
|
208 | :rev => '2457' } | |
259 | ) |
|
209 | ) | |
260 | assert_routing( |
|
210 | assert_routing( | |
261 | { :method => 'get', |
|
211 | { :method => 'get', | |
262 | :path => "/projects/redmine/repository/foo/revisions/2457/diff.diff" }, |
|
212 | :path => "/projects/redmine/repository/foo/revisions/2457/diff.diff" }, | |
263 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', |
|
213 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', | |
264 | :rev => '2457', :format => 'diff' } |
|
214 | :rev => '2457', :format => 'diff' } | |
265 | ) |
|
215 | ) | |
266 | assert_routing( |
|
216 | assert_routing( | |
267 | { :method => 'get', |
|
217 | { :method => 'get', | |
268 | :path => "/projects/redmine/repository/foo/revisions/2/diff/#{@path_hash[:path]}" }, |
|
218 | :path => "/projects/redmine/repository/foo/revisions/2/diff/#{@path_hash[:path]}" }, | |
269 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', |
|
219 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', | |
270 | :path => @path_hash[:param], :rev => '2' } |
|
220 | :path => @path_hash[:param], :rev => '2' } | |
271 | ) |
|
221 | ) | |
272 | assert_routing( |
|
222 | assert_routing( | |
273 | { :method => 'get', |
|
223 | { :method => 'get', | |
274 | :path => "/projects/redmine/repository/foo/revisions/2/entry/#{@path_hash[:path]}" }, |
|
224 | :path => "/projects/redmine/repository/foo/revisions/2/entry/#{@path_hash[:path]}" }, | |
275 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', :repository_id => 'foo', |
|
225 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', :repository_id => 'foo', | |
276 | :path => @path_hash[:param], :rev => '2' } |
|
226 | :path => @path_hash[:param], :rev => '2' } | |
277 | ) |
|
227 | ) | |
278 | assert_routing( |
|
228 | assert_routing( | |
279 | { :method => 'get', |
|
229 | { :method => 'get', | |
280 | :path => "/projects/redmine/repository/foo/revisions/2/raw/#{@path_hash[:path]}" }, |
|
230 | :path => "/projects/redmine/repository/foo/revisions/2/raw/#{@path_hash[:path]}" }, | |
281 | { :controller => 'repositories', :action => 'raw', :id => 'redmine', :repository_id => 'foo', |
|
231 | { :controller => 'repositories', :action => 'raw', :id => 'redmine', :repository_id => 'foo', | |
282 | :path => @path_hash[:param], :rev => '2' } |
|
232 | :path => @path_hash[:param], :rev => '2' } | |
283 | ) |
|
233 | ) | |
284 | assert_routing( |
|
234 | assert_routing( | |
285 | { :method => 'get', |
|
235 | { :method => 'get', | |
286 | :path => "/projects/redmine/repository/foo/revisions/2/annotate/#{@path_hash[:path]}" }, |
|
236 | :path => "/projects/redmine/repository/foo/revisions/2/annotate/#{@path_hash[:path]}" }, | |
287 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', :repository_id => 'foo', |
|
237 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', :repository_id => 'foo', | |
288 | :path => @path_hash[:param], :rev => '2' } |
|
238 | :path => @path_hash[:param], :rev => '2' } | |
289 | ) |
|
239 | ) | |
290 | end |
|
240 | end | |
291 |
|
241 | |||
292 | def test_repositories_non_revisions_path |
|
242 | def test_repositories_non_revisions_path | |
293 | assert_routing( |
|
243 | assert_routing( | |
294 | { :method => 'get', |
|
244 | { :method => 'get', | |
|
245 | :path => "/projects/redmine/repository/changes" }, | |||
|
246 | { :controller => 'repositories', :action => 'changes', :id => 'redmine' } | |||
|
247 | ) | |||
|
248 | ['2457', 'master', 'slash/slash'].each do |rev| | |||
|
249 | assert_routing( | |||
|
250 | { :method => 'get', | |||
|
251 | :path => "/projects/redmine/repository/changes" }, | |||
|
252 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', | |||
|
253 | :rev => rev }, | |||
|
254 | {}, | |||
|
255 | { :rev => rev } | |||
|
256 | ) | |||
|
257 | end | |||
|
258 | ['2457', 'master', 'slash/slash'].each do |rev| | |||
|
259 | assert_routing( | |||
|
260 | { :method => 'get', | |||
|
261 | :path => "/projects/redmine/repository/changes/#{@path_hash[:path]}" }, | |||
|
262 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', | |||
|
263 | :path => @path_hash[:param], :rev => rev }, | |||
|
264 | {}, | |||
|
265 | { :rev => rev } | |||
|
266 | ) | |||
|
267 | end | |||
|
268 | assert_routing( | |||
|
269 | { :method => 'get', | |||
295 | :path => "/projects/redmine/repository/diff/#{@path_hash[:path]}" }, |
|
270 | :path => "/projects/redmine/repository/diff/#{@path_hash[:path]}" }, | |
296 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', |
|
271 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', | |
297 | :path => @path_hash[:param] } |
|
272 | :path => @path_hash[:param] } | |
298 | ) |
|
273 | ) | |
299 | assert_routing( |
|
274 | assert_routing( | |
300 | { :method => 'get', |
|
275 | { :method => 'get', | |
301 | :path => "/projects/redmine/repository/browse/#{@path_hash[:path]}" }, |
|
276 | :path => "/projects/redmine/repository/browse/#{@path_hash[:path]}" }, | |
302 | { :controller => 'repositories', :action => 'browse', :id => 'redmine', |
|
277 | { :controller => 'repositories', :action => 'browse', :id => 'redmine', | |
303 | :path => @path_hash[:param] } |
|
278 | :path => @path_hash[:param] } | |
304 | ) |
|
279 | ) | |
305 | assert_routing( |
|
280 | assert_routing( | |
306 | { :method => 'get', |
|
281 | { :method => 'get', | |
307 | :path => "/projects/redmine/repository/entry/#{@path_hash[:path]}" }, |
|
282 | :path => "/projects/redmine/repository/entry/#{@path_hash[:path]}" }, | |
308 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', |
|
283 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', | |
309 | :path => @path_hash[:param] } |
|
284 | :path => @path_hash[:param] } | |
310 | ) |
|
285 | ) | |
311 | assert_routing( |
|
286 | assert_routing( | |
312 | { :method => 'get', |
|
287 | { :method => 'get', | |
313 | :path => "/projects/redmine/repository/raw/#{@path_hash[:path]}" }, |
|
288 | :path => "/projects/redmine/repository/raw/#{@path_hash[:path]}" }, | |
314 | { :controller => 'repositories', :action => 'raw', :id => 'redmine', |
|
289 | { :controller => 'repositories', :action => 'raw', :id => 'redmine', | |
315 | :path => @path_hash[:param] } |
|
290 | :path => @path_hash[:param] } | |
316 | ) |
|
291 | ) | |
317 | assert_routing( |
|
292 | assert_routing( | |
318 | { :method => 'get', |
|
293 | { :method => 'get', | |
319 | :path => "/projects/redmine/repository/annotate/#{@path_hash[:path]}" }, |
|
294 | :path => "/projects/redmine/repository/annotate/#{@path_hash[:path]}" }, | |
320 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', |
|
295 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', | |
321 | :path => @path_hash[:param] } |
|
296 | :path => @path_hash[:param] } | |
322 | ) |
|
297 | ) | |
323 | assert_routing( |
|
298 | assert_routing( | |
324 | { :method => 'get', |
|
299 | { :method => 'get', | |
325 | :path => "/projects/redmine/repository/changes/#{@path_hash[:path]}" }, |
|
300 | :path => "/projects/redmine/repository/changes/#{@path_hash[:path]}" }, | |
326 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', |
|
301 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', | |
327 | :path => @path_hash[:param] } |
|
302 | :path => @path_hash[:param] } | |
328 | ) |
|
303 | ) | |
329 | assert_routing( |
|
304 | assert_routing( | |
330 | { :method => 'get', |
|
305 | { :method => 'get', | |
331 | :path => "/projects/redmine/repository/revision" }, |
|
306 | :path => "/projects/redmine/repository/revision" }, | |
332 | { :controller => 'repositories', :action => 'revision', :id => 'redmine' } |
|
307 | { :controller => 'repositories', :action => 'revision', :id => 'redmine' } | |
333 | ) |
|
308 | ) | |
334 | end |
|
309 | end | |
335 |
|
310 | |||
336 | def test_repositories_non_revisions_path_with_repository_id |
|
311 | def test_repositories_non_revisions_path_with_repository_id | |
337 | assert_routing( |
|
312 | assert_routing( | |
338 | { :method => 'get', |
|
313 | { :method => 'get', | |
|
314 | :path => "/projects/redmine/repository/foo/changes" }, | |||
|
315 | { :controller => 'repositories', :action => 'changes', | |||
|
316 | :id => 'redmine', :repository_id => 'foo' } | |||
|
317 | ) | |||
|
318 | ['2457', 'master', 'slash/slash'].each do |rev| | |||
|
319 | assert_routing( | |||
|
320 | { :method => 'get', | |||
|
321 | :path => "/projects/redmine/repository/foo/changes" }, | |||
|
322 | { :controller => 'repositories', :action => 'changes', | |||
|
323 | :id => 'redmine', | |||
|
324 | :repository_id => 'foo', :rev => rev }, | |||
|
325 | {}, | |||
|
326 | { :rev => rev } | |||
|
327 | ) | |||
|
328 | end | |||
|
329 | ['2457', 'master', 'slash/slash'].each do |rev| | |||
|
330 | assert_routing( | |||
|
331 | { :method => 'get', | |||
|
332 | :path => "/projects/redmine/repository/foo/changes/#{@path_hash[:path]}" }, | |||
|
333 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', | |||
|
334 | :repository_id => 'foo', :path => @path_hash[:param], :rev => rev }, | |||
|
335 | {}, | |||
|
336 | { :rev => rev } | |||
|
337 | ) | |||
|
338 | end | |||
|
339 | assert_routing( | |||
|
340 | { :method => 'get', | |||
339 | :path => "/projects/redmine/repository/foo/diff/#{@path_hash[:path]}" }, |
|
341 | :path => "/projects/redmine/repository/foo/diff/#{@path_hash[:path]}" }, | |
340 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', |
|
342 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', | |
341 | :path => @path_hash[:param] } |
|
343 | :path => @path_hash[:param] } | |
342 | ) |
|
344 | ) | |
343 | assert_routing( |
|
345 | assert_routing( | |
344 | { :method => 'get', |
|
346 | { :method => 'get', | |
345 | :path => "/projects/redmine/repository/foo/browse/#{@path_hash[:path]}" }, |
|
347 | :path => "/projects/redmine/repository/foo/browse/#{@path_hash[:path]}" }, | |
346 | { :controller => 'repositories', :action => 'browse', :id => 'redmine', :repository_id => 'foo', |
|
348 | { :controller => 'repositories', :action => 'browse', :id => 'redmine', :repository_id => 'foo', | |
347 | :path => @path_hash[:param] } |
|
349 | :path => @path_hash[:param] } | |
348 | ) |
|
350 | ) | |
349 | assert_routing( |
|
351 | assert_routing( | |
350 | { :method => 'get', |
|
352 | { :method => 'get', | |
351 | :path => "/projects/redmine/repository/foo/entry/#{@path_hash[:path]}" }, |
|
353 | :path => "/projects/redmine/repository/foo/entry/#{@path_hash[:path]}" }, | |
352 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', :repository_id => 'foo', |
|
354 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', :repository_id => 'foo', | |
353 | :path => @path_hash[:param] } |
|
355 | :path => @path_hash[:param] } | |
354 | ) |
|
356 | ) | |
355 | assert_routing( |
|
357 | assert_routing( | |
356 | { :method => 'get', |
|
358 | { :method => 'get', | |
357 | :path => "/projects/redmine/repository/foo/raw/#{@path_hash[:path]}" }, |
|
359 | :path => "/projects/redmine/repository/foo/raw/#{@path_hash[:path]}" }, | |
358 | { :controller => 'repositories', :action => 'raw', :id => 'redmine', :repository_id => 'foo', |
|
360 | { :controller => 'repositories', :action => 'raw', :id => 'redmine', :repository_id => 'foo', | |
359 | :path => @path_hash[:param] } |
|
361 | :path => @path_hash[:param] } | |
360 | ) |
|
362 | ) | |
361 | assert_routing( |
|
363 | assert_routing( | |
362 | { :method => 'get', |
|
364 | { :method => 'get', | |
363 | :path => "/projects/redmine/repository/foo/annotate/#{@path_hash[:path]}" }, |
|
365 | :path => "/projects/redmine/repository/foo/annotate/#{@path_hash[:path]}" }, | |
364 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', :repository_id => 'foo', |
|
366 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', :repository_id => 'foo', | |
365 | :path => @path_hash[:param] } |
|
367 | :path => @path_hash[:param] } | |
366 | ) |
|
368 | ) | |
367 | assert_routing( |
|
369 | assert_routing( | |
368 | { :method => 'get', |
|
370 | { :method => 'get', | |
369 | :path => "/projects/redmine/repository/foo/changes/#{@path_hash[:path]}" }, |
|
371 | :path => "/projects/redmine/repository/foo/changes/#{@path_hash[:path]}" }, | |
370 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', :repository_id => 'foo', |
|
372 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', :repository_id => 'foo', | |
371 | :path => @path_hash[:param] } |
|
373 | :path => @path_hash[:param] } | |
372 | ) |
|
374 | ) | |
373 | assert_routing( |
|
375 | assert_routing( | |
374 | { :method => 'get', |
|
376 | { :method => 'get', | |
375 | :path => "/projects/redmine/repository/foo/revision" }, |
|
377 | :path => "/projects/redmine/repository/foo/revision" }, | |
376 | { :controller => 'repositories', :action => 'revision', :id => 'redmine', :repository_id => 'foo'} |
|
378 | { :controller => 'repositories', :action => 'revision', :id => 'redmine', :repository_id => 'foo'} | |
377 | ) |
|
379 | ) | |
378 | end |
|
380 | end | |
379 |
|
381 | |||
380 | def test_repositories_related_issues |
|
382 | def test_repositories_related_issues | |
381 | assert_routing( |
|
383 | assert_routing( | |
382 | { :method => 'post', |
|
384 | { :method => 'post', | |
383 | :path => "/projects/redmine/repository/revisions/123/issues" }, |
|
385 | :path => "/projects/redmine/repository/revisions/123/issues" }, | |
384 | { :controller => 'repositories', :action => 'add_related_issue', |
|
386 | { :controller => 'repositories', :action => 'add_related_issue', | |
385 | :id => 'redmine', :rev => '123' } |
|
387 | :id => 'redmine', :rev => '123' } | |
386 | ) |
|
388 | ) | |
387 | assert_routing( |
|
389 | assert_routing( | |
388 | { :method => 'delete', |
|
390 | { :method => 'delete', | |
389 | :path => "/projects/redmine/repository/revisions/123/issues/25" }, |
|
391 | :path => "/projects/redmine/repository/revisions/123/issues/25" }, | |
390 | { :controller => 'repositories', :action => 'remove_related_issue', |
|
392 | { :controller => 'repositories', :action => 'remove_related_issue', | |
391 | :id => 'redmine', :rev => '123', :issue_id => '25' } |
|
393 | :id => 'redmine', :rev => '123', :issue_id => '25' } | |
392 | ) |
|
394 | ) | |
393 | end |
|
395 | end | |
394 |
|
396 | |||
395 | def test_repositories_related_issues_with_repository_id |
|
397 | def test_repositories_related_issues_with_repository_id | |
396 | assert_routing( |
|
398 | assert_routing( | |
397 | { :method => 'post', |
|
399 | { :method => 'post', | |
398 | :path => "/projects/redmine/repository/foo/revisions/123/issues" }, |
|
400 | :path => "/projects/redmine/repository/foo/revisions/123/issues" }, | |
399 | { :controller => 'repositories', :action => 'add_related_issue', |
|
401 | { :controller => 'repositories', :action => 'add_related_issue', | |
400 | :id => 'redmine', :repository_id => 'foo', :rev => '123' } |
|
402 | :id => 'redmine', :repository_id => 'foo', :rev => '123' } | |
401 | ) |
|
403 | ) | |
402 | assert_routing( |
|
404 | assert_routing( | |
403 | { :method => 'delete', |
|
405 | { :method => 'delete', | |
404 | :path => "/projects/redmine/repository/foo/revisions/123/issues/25" }, |
|
406 | :path => "/projects/redmine/repository/foo/revisions/123/issues/25" }, | |
405 | { :controller => 'repositories', :action => 'remove_related_issue', |
|
407 | { :controller => 'repositories', :action => 'remove_related_issue', | |
406 | :id => 'redmine', :repository_id => 'foo', :rev => '123', :issue_id => '25' } |
|
408 | :id => 'redmine', :repository_id => 'foo', :rev => '123', :issue_id => '25' } | |
407 | ) |
|
409 | ) | |
408 | end |
|
410 | end | |
409 | end |
|
411 | end |
General Comments 0
You need to be logged in to leave comments.
Login now