reset Attachment.storage_path at the end of attachment tests
Attachment files are deleted when database data were deleted. So, other tests fail. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7911 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
4e83057e76
commit
be29227c12
|
@ -50,6 +50,7 @@ class AttachmentsControllerTest < ActionController::TestCase
|
|||
:attributes => {:class => /line-code/},
|
||||
:content => /Demande créée avec succès/
|
||||
end
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
|
||||
def test_show_diff_replcace_cannot_convert_content
|
||||
|
@ -68,6 +69,7 @@ class AttachmentsControllerTest < ActionController::TestCase
|
|||
:content => /Demande cr\?\?e avec succ\?s/
|
||||
end
|
||||
end
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
|
||||
def test_show_diff_latin_1
|
||||
|
@ -86,6 +88,7 @@ class AttachmentsControllerTest < ActionController::TestCase
|
|||
:content => /Demande créée avec succès/
|
||||
end
|
||||
end
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
|
||||
def test_show_text_file
|
||||
|
@ -93,6 +96,7 @@ class AttachmentsControllerTest < ActionController::TestCase
|
|||
assert_response :success
|
||||
assert_template 'file'
|
||||
assert_equal 'text/html', @response.content_type
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
|
||||
def test_show_text_file_utf_8
|
||||
|
@ -163,17 +167,20 @@ class AttachmentsControllerTest < ActionController::TestCase
|
|||
get :show, :id => 4
|
||||
assert_response :success
|
||||
assert_equal 'application/x-ruby', @response.content_type
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
|
||||
def test_show_other
|
||||
get :show, :id => 6
|
||||
assert_response :success
|
||||
assert_equal 'application/octet-stream', @response.content_type
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
|
||||
def test_show_file_from_private_issue_without_permission
|
||||
get :show, :id => 15
|
||||
assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Fattachments%2F15'
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
|
||||
def test_show_file_from_private_issue_with_permission
|
||||
|
@ -181,12 +188,14 @@ class AttachmentsControllerTest < ActionController::TestCase
|
|||
get :show, :id => 15
|
||||
assert_response :success
|
||||
assert_tag 'h2', :content => /private.diff/
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
|
||||
def test_download_text_file
|
||||
get :download, :id => 4
|
||||
assert_response :success
|
||||
assert_equal 'application/x-ruby', @response.content_type
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
|
||||
def test_download_should_assign_content_type_if_blank
|
||||
|
@ -195,16 +204,19 @@ class AttachmentsControllerTest < ActionController::TestCase
|
|||
get :download, :id => 4
|
||||
assert_response :success
|
||||
assert_equal 'text/x-ruby', @response.content_type
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
|
||||
def test_download_missing_file
|
||||
get :download, :id => 2
|
||||
assert_response 404
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
|
||||
def test_anonymous_on_private_private
|
||||
get :download, :id => 7
|
||||
assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Fattachments%2Fdownload%2F7'
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
|
||||
def test_destroy_issue_attachment
|
||||
|
@ -221,6 +233,7 @@ class AttachmentsControllerTest < ActionController::TestCase
|
|||
assert_equal 'attachment', j.details.first.property
|
||||
assert_equal '1', j.details.first.prop_key
|
||||
assert_equal 'error281.txt', j.details.first.old_value
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
|
||||
def test_destroy_wiki_page_attachment
|
||||
|
@ -229,6 +242,7 @@ class AttachmentsControllerTest < ActionController::TestCase
|
|||
post :destroy, :id => 3
|
||||
assert_response 302
|
||||
end
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
|
||||
def test_destroy_project_attachment
|
||||
|
@ -237,6 +251,7 @@ class AttachmentsControllerTest < ActionController::TestCase
|
|||
post :destroy, :id => 8
|
||||
assert_response 302
|
||||
end
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
|
||||
def test_destroy_version_attachment
|
||||
|
@ -245,11 +260,13 @@ class AttachmentsControllerTest < ActionController::TestCase
|
|||
post :destroy, :id => 9
|
||||
assert_response 302
|
||||
end
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
|
||||
def test_destroy_without_permission
|
||||
post :destroy, :id => 3
|
||||
assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Fattachments%2Fdestroy%2F3'
|
||||
assert Attachment.find_by_id(3)
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
end
|
||||
|
|
|
@ -37,7 +37,6 @@ class ApiTest::AttachmentsTest < ActionController::IntegrationTest
|
|||
context "GET" do
|
||||
should "return the attachment" do
|
||||
get '/attachments/7.xml', {}, :authorization => credentials('jsmith')
|
||||
|
||||
assert_response :success
|
||||
assert_equal 'application/xml', @response.content_type
|
||||
assert_tag :tag => 'attachment',
|
||||
|
@ -57,8 +56,8 @@ class ApiTest::AttachmentsTest < ActionController::IntegrationTest
|
|||
|
||||
should "deny access without credentials" do
|
||||
get '/attachments/7.xml'
|
||||
|
||||
assert_response 401
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -66,16 +65,17 @@ class ApiTest::AttachmentsTest < ActionController::IntegrationTest
|
|||
context "/attachments/download/:id/:filename" do
|
||||
context "GET" do
|
||||
should "return the attachment content" do
|
||||
get '/attachments/download/7/archive.zip', {}, :authorization => credentials('jsmith')
|
||||
|
||||
get '/attachments/download/7/archive.zip',
|
||||
{}, :authorization => credentials('jsmith')
|
||||
assert_response :success
|
||||
assert_equal 'application/octet-stream', @response.content_type
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
|
||||
should "deny access without credentials" do
|
||||
get '/attachments/download/7/archive.zip'
|
||||
|
||||
assert_response 302
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -141,5 +141,7 @@ class AttachmentTest < ActiveSupport::TestCase
|
|||
assert_equal 17, la1.id
|
||||
la2 = Attachment.latest_attach([a1, a2], "Testfile.PNG")
|
||||
assert_equal 17, la2.id
|
||||
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
end
|
||||
|
|
|
@ -203,6 +203,7 @@ RAW
|
|||
}
|
||||
attachments = [a1, a2]
|
||||
to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text, :attachments => attachments) }
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
|
||||
def test_textile_external_links
|
||||
|
|
Loading…
Reference in New Issue