mirror of
https://github.com/redmine/redmine.git
synced 2025-11-15 09:46:02 +01:00
Fixes not to call set_tmp_attachments_directory twice after each test (#32094).
Patch by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@18484 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -46,7 +46,6 @@ class AttachmentsControllerTest < Redmine::ControllerTest
|
|||||||
assert_select 'th.filename', :text => /issues_controller.rb\t\(révision 1484\)/
|
assert_select 'th.filename', :text => /issues_controller.rb\t\(révision 1484\)/
|
||||||
assert_select 'td.line-code', :text => /Demande créée avec succès/
|
assert_select 'td.line-code', :text => /Demande créée avec succès/
|
||||||
end
|
end
|
||||||
set_tmp_attachments_directory
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_show_diff_replace_cannot_convert_content
|
def test_show_diff_replace_cannot_convert_content
|
||||||
@@ -64,7 +63,6 @@ class AttachmentsControllerTest < Redmine::ControllerTest
|
|||||||
assert_select 'td.line-code', :text => /Demande cr\?\?e avec succ\?s/
|
assert_select 'td.line-code', :text => /Demande cr\?\?e avec succ\?s/
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
set_tmp_attachments_directory
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_show_diff_latin_1
|
def test_show_diff_latin_1
|
||||||
@@ -82,7 +80,6 @@ class AttachmentsControllerTest < Redmine::ControllerTest
|
|||||||
assert_select 'td.line-code', :text => /Demande créée avec succès/
|
assert_select 'td.line-code', :text => /Demande créée avec succès/
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
set_tmp_attachments_directory
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_show_should_save_diff_type_as_user_preference
|
def test_show_should_save_diff_type_as_user_preference
|
||||||
@@ -132,7 +129,6 @@ class AttachmentsControllerTest < Redmine::ControllerTest
|
|||||||
}
|
}
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal 'text/html', @response.content_type
|
assert_equal 'text/html', @response.content_type
|
||||||
set_tmp_attachments_directory
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_show_text_file_utf_8
|
def test_show_text_file_utf_8
|
||||||
@@ -207,7 +203,6 @@ class AttachmentsControllerTest < Redmine::ControllerTest
|
|||||||
assert_equal 'text/html', @response.content_type
|
assert_equal 'text/html', @response.content_type
|
||||||
assert_select '.nodata', :text => 'No preview available. Download the file instead.'
|
assert_select '.nodata', :text => 'No preview available. Download the file instead.'
|
||||||
end
|
end
|
||||||
set_tmp_attachments_directory
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_show_image
|
def test_show_image
|
||||||
@@ -227,7 +222,6 @@ class AttachmentsControllerTest < Redmine::ControllerTest
|
|||||||
}
|
}
|
||||||
assert_equal 'text/html', @response.content_type
|
assert_equal 'text/html', @response.content_type
|
||||||
assert_select '.nodata', :text => 'No preview available. Download the file instead.'
|
assert_select '.nodata', :text => 'No preview available. Download the file instead.'
|
||||||
set_tmp_attachments_directory
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_show_file_from_private_issue_without_permission
|
def test_show_file_from_private_issue_without_permission
|
||||||
@@ -235,7 +229,6 @@ class AttachmentsControllerTest < Redmine::ControllerTest
|
|||||||
:id => 15
|
:id => 15
|
||||||
}
|
}
|
||||||
assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Fattachments%2F15'
|
assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Fattachments%2F15'
|
||||||
set_tmp_attachments_directory
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_show_file_from_private_issue_with_permission
|
def test_show_file_from_private_issue_with_permission
|
||||||
@@ -245,7 +238,6 @@ class AttachmentsControllerTest < Redmine::ControllerTest
|
|||||||
}
|
}
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_select 'h2', :text => /private.diff/
|
assert_select 'h2', :text => /private.diff/
|
||||||
set_tmp_attachments_directory
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_show_file_without_container_should_be_allowed_to_author
|
def test_show_file_without_container_should_be_allowed_to_author
|
||||||
@@ -291,8 +283,6 @@ class AttachmentsControllerTest < Redmine::ControllerTest
|
|||||||
|
|
||||||
assert_select 'ul.pages li.next', :text => /next/i
|
assert_select 'ul.pages li.next', :text => /next/i
|
||||||
assert_select 'ul.pages li.previous', :text => /previous/i
|
assert_select 'ul.pages li.previous', :text => /previous/i
|
||||||
|
|
||||||
set_tmp_attachments_directory
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_download_text_file
|
def test_download_text_file
|
||||||
@@ -309,8 +299,6 @@ class AttachmentsControllerTest < Redmine::ControllerTest
|
|||||||
:id => 4
|
:id => 4
|
||||||
}
|
}
|
||||||
assert_response 304
|
assert_response 304
|
||||||
|
|
||||||
set_tmp_attachments_directory
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_download_js_file
|
def test_download_js_file
|
||||||
@@ -344,7 +332,6 @@ class AttachmentsControllerTest < Redmine::ControllerTest
|
|||||||
}
|
}
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal 'text/x-ruby', @response.content_type
|
assert_equal 'text/x-ruby', @response.content_type
|
||||||
set_tmp_attachments_directory
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_download_should_assign_better_content_type_than_application_octet_stream
|
def test_download_should_assign_better_content_type_than_application_octet_stream
|
||||||
@@ -355,7 +342,6 @@ class AttachmentsControllerTest < Redmine::ControllerTest
|
|||||||
}
|
}
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal 'text/x-ruby', @response.content_type
|
assert_equal 'text/x-ruby', @response.content_type
|
||||||
set_tmp_attachments_directory
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_download_should_assign_application_octet_stream_if_content_type_is_not_determined
|
def test_download_should_assign_application_octet_stream_if_content_type_is_not_determined
|
||||||
@@ -365,7 +351,6 @@ class AttachmentsControllerTest < Redmine::ControllerTest
|
|||||||
assert_response :success
|
assert_response :success
|
||||||
assert_nil Redmine::MimeType.of(attachments(:attachments_022).filename)
|
assert_nil Redmine::MimeType.of(attachments(:attachments_022).filename)
|
||||||
assert_equal 'application/octet-stream', @response.content_type
|
assert_equal 'application/octet-stream', @response.content_type
|
||||||
set_tmp_attachments_directory
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_download_missing_file
|
def test_download_missing_file
|
||||||
@@ -373,7 +358,6 @@ class AttachmentsControllerTest < Redmine::ControllerTest
|
|||||||
:id => 2
|
:id => 2
|
||||||
}
|
}
|
||||||
assert_response 404
|
assert_response 404
|
||||||
set_tmp_attachments_directory
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_download_should_be_denied_without_permission
|
def test_download_should_be_denied_without_permission
|
||||||
@@ -381,7 +365,6 @@ class AttachmentsControllerTest < Redmine::ControllerTest
|
|||||||
:id => 7
|
:id => 7
|
||||||
}
|
}
|
||||||
assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Fattachments%2Fdownload%2F7'
|
assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Fattachments%2Fdownload%2F7'
|
||||||
set_tmp_attachments_directory
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if convert_installed?
|
if convert_installed?
|
||||||
|
|||||||
@@ -61,20 +61,17 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base
|
|||||||
test "GET /attachments/:id.xml should deny access without credentials" do
|
test "GET /attachments/:id.xml should deny access without credentials" do
|
||||||
get '/attachments/7.xml'
|
get '/attachments/7.xml'
|
||||||
assert_response 401
|
assert_response 401
|
||||||
set_tmp_attachments_directory
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test "GET /attachments/download/:id/:filename should return the attachment content" do
|
test "GET /attachments/download/:id/:filename should return the attachment content" do
|
||||||
get '/attachments/download/7/archive.zip', :headers => credentials('jsmith')
|
get '/attachments/download/7/archive.zip', :headers => credentials('jsmith')
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal 'application/zip', @response.content_type
|
assert_equal 'application/zip', @response.content_type
|
||||||
set_tmp_attachments_directory
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test "GET /attachments/download/:id/:filename should deny access without credentials" do
|
test "GET /attachments/download/:id/:filename should deny access without credentials" do
|
||||||
get '/attachments/download/7/archive.zip'
|
get '/attachments/download/7/archive.zip'
|
||||||
assert_response 401
|
assert_response 401
|
||||||
set_tmp_attachments_directory
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test "GET /attachments/thumbnail/:id should return the thumbnail" do
|
test "GET /attachments/thumbnail/:id should return the thumbnail" do
|
||||||
|
|||||||
Reference in New Issue
Block a user