##// END OF EJS Templates
Prevent fixture files from being deleted....
Jean-Philippe Lang -
r7863:9ed5d1dd027c
parent child
Show More
@@ -220,6 +220,7 class AttachmentsControllerTest < ActionController::TestCase
220 end
220 end
221
221
222 def test_destroy_issue_attachment
222 def test_destroy_issue_attachment
223 set_tmp_attachments_directory
223 issue = Issue.find(3)
224 issue = Issue.find(3)
224 @request.session[:user_id] = 2
225 @request.session[:user_id] = 2
225
226
@@ -233,42 +234,41 class AttachmentsControllerTest < ActionController::TestCase
233 assert_equal 'attachment', j.details.first.property
234 assert_equal 'attachment', j.details.first.property
234 assert_equal '1', j.details.first.prop_key
235 assert_equal '1', j.details.first.prop_key
235 assert_equal 'error281.txt', j.details.first.old_value
236 assert_equal 'error281.txt', j.details.first.old_value
236 set_tmp_attachments_directory
237 end
237 end
238
238
239 def test_destroy_wiki_page_attachment
239 def test_destroy_wiki_page_attachment
240 set_tmp_attachments_directory
240 @request.session[:user_id] = 2
241 @request.session[:user_id] = 2
241 assert_difference 'Attachment.count', -1 do
242 assert_difference 'Attachment.count', -1 do
242 delete :destroy, :id => 3
243 delete :destroy, :id => 3
243 assert_response 302
244 assert_response 302
244 end
245 end
245 set_tmp_attachments_directory
246 end
246 end
247
247
248 def test_destroy_project_attachment
248 def test_destroy_project_attachment
249 set_tmp_attachments_directory
249 @request.session[:user_id] = 2
250 @request.session[:user_id] = 2
250 assert_difference 'Attachment.count', -1 do
251 assert_difference 'Attachment.count', -1 do
251 delete :destroy, :id => 8
252 delete :destroy, :id => 8
252 assert_response 302
253 assert_response 302
253 end
254 end
254 set_tmp_attachments_directory
255 end
255 end
256
256
257 def test_destroy_version_attachment
257 def test_destroy_version_attachment
258 set_tmp_attachments_directory
258 @request.session[:user_id] = 2
259 @request.session[:user_id] = 2
259 assert_difference 'Attachment.count', -1 do
260 assert_difference 'Attachment.count', -1 do
260 delete :destroy, :id => 9
261 delete :destroy, :id => 9
261 assert_response 302
262 assert_response 302
262 end
263 end
263 set_tmp_attachments_directory
264 end
264 end
265
265
266 def test_destroy_without_permission
266 def test_destroy_without_permission
267 set_tmp_attachments_directory
267 assert_no_difference 'Attachment.count' do
268 assert_no_difference 'Attachment.count' do
268 delete :destroy, :id => 3
269 delete :destroy, :id => 3
269 end
270 end
270 assert_response 302
271 assert_response 302
271 assert Attachment.find_by_id(3)
272 assert Attachment.find_by_id(3)
272 set_tmp_attachments_directory
273 end
273 end
274 end
274 end
General Comments 0
You need to be logged in to leave comments. Login now