##// END OF EJS Templates
scm: subversion: change some functional tests project id from 1 to 3....
Toshi MARUYAMA -
r4776:3e463c4e6928
parent child
Show More
@@ -26,17 +26,26 class RepositoriesSubversionControllerTest < ActionController::TestCase
26 26 :repositories, :issues, :issue_statuses, :changesets, :changes,
27 27 :issue_categories, :enumerations, :custom_fields, :custom_values, :trackers
28 28
29 PRJ_ID = 3
30
29 31 def setup
30 32 @controller = RepositoriesController.new
31 33 @request = ActionController::TestRequest.new
32 34 @response = ActionController::TestResponse.new
33 35 Setting.default_language = 'en'
34 36 User.current = nil
37
38 @project = Project.find(PRJ_ID)
39 @repository = Repository::Subversion.create(:project => @project,
40 :url => "file://#{self.class.repository_path('subversion')}")
41 assert @repository
35 42 end
36 43
37 44 if repository_configured?('subversion')
38 45 def test_show
39 get :show, :id => 1
46 @repository.fetch_changesets
47 @repository.reload
48 get :show, :id => PRJ_ID
40 49 assert_response :success
41 50 assert_template 'show'
42 51 assert_not_nil assigns(:entries)
@@ -44,7 +53,9 class RepositoriesSubversionControllerTest < ActionController::TestCase
44 53 end
45 54
46 55 def test_browse_root
47 get :show, :id => 1
56 @repository.fetch_changesets
57 @repository.reload
58 get :show, :id => PRJ_ID
48 59 assert_response :success
49 60 assert_template 'show'
50 61 assert_not_nil assigns(:entries)
@@ -53,7 +64,9 class RepositoriesSubversionControllerTest < ActionController::TestCase
53 64 end
54 65
55 66 def test_browse_directory
56 get :show, :id => 1, :path => ['subversion_test']
67 @repository.fetch_changesets
68 @repository.reload
69 get :show, :id => PRJ_ID, :path => ['subversion_test']
57 70 assert_response :success
58 71 assert_template 'show'
59 72 assert_not_nil assigns(:entries)
@@ -65,7 +78,9 class RepositoriesSubversionControllerTest < ActionController::TestCase
65 78 end
66 79
67 80 def test_browse_at_given_revision
68 get :show, :id => 1, :path => ['subversion_test'], :rev => 4
81 @repository.fetch_changesets
82 @repository.reload
83 get :show, :id => PRJ_ID, :path => ['subversion_test'], :rev => 4
69 84 assert_response :success
70 85 assert_template 'show'
71 86 assert_not_nil assigns(:entries)
@@ -73,7 +88,9 class RepositoriesSubversionControllerTest < ActionController::TestCase
73 88 end
74 89
75 90 def test_file_changes
76 get :changes, :id => 1, :path => ['subversion_test', 'folder', 'helloworld.rb' ]
91 @repository.fetch_changesets
92 @repository.reload
93 get :changes, :id => PRJ_ID, :path => ['subversion_test', 'folder', 'helloworld.rb' ]
77 94 assert_response :success
78 95 assert_template 'changes'
79 96
@@ -93,7 +110,9 class RepositoriesSubversionControllerTest < ActionController::TestCase
93 110 end
94 111
95 112 def test_directory_changes
96 get :changes, :id => 1, :path => ['subversion_test', 'folder' ]
113 @repository.fetch_changesets
114 @repository.reload
115 get :changes, :id => PRJ_ID, :path => ['subversion_test', 'folder' ]
97 116 assert_response :success
98 117 assert_template 'changes'
99 118
@@ -103,15 +122,19 class RepositoriesSubversionControllerTest < ActionController::TestCase
103 122 end
104 123
105 124 def test_entry
106 get :entry, :id => 1, :path => ['subversion_test', 'helloworld.c']
125 @repository.fetch_changesets
126 @repository.reload
127 get :entry, :id => PRJ_ID, :path => ['subversion_test', 'helloworld.c']
107 128 assert_response :success
108 129 assert_template 'entry'
109 130 end
110 131
111 132 def test_entry_should_send_if_too_big
133 @repository.fetch_changesets
134 @repository.reload
112 135 # no files in the test repo is larger than 1KB...
113 136 with_settings :file_max_size_displayed => 0 do
114 get :entry, :id => 1, :path => ['subversion_test', 'helloworld.c']
137 get :entry, :id => PRJ_ID, :path => ['subversion_test', 'helloworld.c']
115 138 assert_response :success
116 139 assert_template ''
117 140 assert_equal 'attachment; filename="helloworld.c"', @response.headers['Content-Disposition']
@@ -119,7 +142,9 class RepositoriesSubversionControllerTest < ActionController::TestCase
119 142 end
120 143
121 144 def test_entry_at_given_revision
122 get :entry, :id => 1, :path => ['subversion_test', 'helloworld.rb'], :rev => 2
145 @repository.fetch_changesets
146 @repository.reload
147 get :entry, :id => PRJ_ID, :path => ['subversion_test', 'helloworld.rb'], :rev => 2
123 148 assert_response :success
124 149 assert_template 'entry'
125 150 # this line was removed in r3 and file was moved in r6
@@ -128,27 +153,36 class RepositoriesSubversionControllerTest < ActionController::TestCase
128 153 end
129 154
130 155 def test_entry_not_found
131 get :entry, :id => 1, :path => ['subversion_test', 'zzz.c']
156 @repository.fetch_changesets
157 @repository.reload
158 get :entry, :id => PRJ_ID, :path => ['subversion_test', 'zzz.c']
132 159 assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ },
133 160 :content => /The entry or revision was not found in the repository/
134 161 end
135 162
136 163 def test_entry_download
137 get :entry, :id => 1, :path => ['subversion_test', 'helloworld.c'], :format => 'raw'
164 @repository.fetch_changesets
165 @repository.reload
166 get :entry, :id => PRJ_ID, :path => ['subversion_test', 'helloworld.c'], :format => 'raw'
138 167 assert_response :success
139 168 assert_template ''
140 169 assert_equal 'attachment; filename="helloworld.c"', @response.headers['Content-Disposition']
141 170 end
142 171
143 172 def test_directory_entry
144 get :entry, :id => 1, :path => ['subversion_test', 'folder']
173 @repository.fetch_changesets
174 @repository.reload
175 get :entry, :id => PRJ_ID, :path => ['subversion_test', 'folder']
145 176 assert_response :success
146 177 assert_template 'show'
147 178 assert_not_nil assigns(:entry)
148 179 assert_equal 'folder', assigns(:entry).name
149 180 end
150 181
182 # TODO: this test needs fixtures.
151 183 def test_revision
184 @repository.fetch_changesets
185 @repository.reload
152 186 get :revision, :id => 1, :rev => 2
153 187 assert_response :success
154 188 assert_template 'revision'
@@ -167,25 +201,30 class RepositoriesSubversionControllerTest < ActionController::TestCase
167 201 end
168 202
169 203 def test_invalid_revision
170 get :revision, :id => 1, :rev => 'something_weird'
204 @repository.fetch_changesets
205 @repository.reload
206 get :revision, :id => PRJ_ID, :rev => 'something_weird'
171 207 assert_response 404
172 208 assert_error_tag :content => /was not found/
173 209 end
174 210
175 211 def test_invalid_revision_diff
176 get :diff, :id => 1, :rev => '1', :rev_to => 'something_weird'
212 get :diff, :id => PRJ_ID, :rev => '1', :rev_to => 'something_weird'
177 213 assert_response 404
178 214 assert_error_tag :content => /was not found/
179 215 end
180 216
181 217 def test_empty_revision
218 @repository.fetch_changesets
219 @repository.reload
182 220 ['', ' ', nil].each do |r|
183 get :revision, :id => 1, :rev => r
221 get :revision, :id => PRJ_ID, :rev => r
184 222 assert_response 404
185 223 assert_error_tag :content => /was not found/
186 224 end
187 225 end
188 226
227 # TODO: this test needs fixtures.
189 228 def test_revision_with_repository_pointing_to_a_subdirectory
190 229 r = Project.find(1).repository
191 230 # Changes repository url to a subdirectory
@@ -209,7 +248,9 class RepositoriesSubversionControllerTest < ActionController::TestCase
209 248 end
210 249
211 250 def test_revision_diff
212 get :diff, :id => 1, :rev => 3
251 @repository.fetch_changesets
252 @repository.reload
253 get :diff, :id => PRJ_ID, :rev => 3
213 254 assert_response :success
214 255 assert_template 'diff'
215 256
@@ -217,7 +258,9 class RepositoriesSubversionControllerTest < ActionController::TestCase
217 258 end
218 259
219 260 def test_directory_diff
220 get :diff, :id => 1, :rev => 6, :rev_to => 2, :path => ['subversion_test', 'folder']
261 @repository.fetch_changesets
262 @repository.reload
263 get :diff, :id => PRJ_ID, :rev => 6, :rev_to => 2, :path => ['subversion_test', 'folder']
221 264 assert_response :success
222 265 assert_template 'diff'
223 266
@@ -230,13 +273,17 class RepositoriesSubversionControllerTest < ActionController::TestCase
230 273 end
231 274
232 275 def test_annotate
233 get :annotate, :id => 1, :path => ['subversion_test', 'helloworld.c']
276 @repository.fetch_changesets
277 @repository.reload
278 get :annotate, :id => PRJ_ID, :path => ['subversion_test', 'helloworld.c']
234 279 assert_response :success
235 280 assert_template 'annotate'
236 281 end
237 282
238 283 def test_annotate_at_given_revision
239 get :annotate, :id => 1, :rev => 8, :path => ['subversion_test', 'helloworld.c']
284 @repository.fetch_changesets
285 @repository.reload
286 get :annotate, :id => PRJ_ID, :rev => 8, :path => ['subversion_test', 'helloworld.c']
240 287 assert_response :success
241 288 assert_template 'annotate'
242 289 assert_tag :tag => 'h2', :content => /@ 8/
General Comments 0
You need to be logged in to leave comments. Login now