mirror of
https://github.com/redmine/redmine.git
synced 2025-11-12 00:06:01 +01:00
Fix test failure due to missing call to set_tmp_attachments_directory (#32122).
Patch by Yuichi HARADA. git-svn-id: http://svn.redmine.org/redmine/trunk@18593 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -234,6 +234,7 @@ LOREM
|
||||
end
|
||||
|
||||
def test_destroy
|
||||
set_tmp_attachments_directory
|
||||
@request.session[:user_id] = 2
|
||||
assert_difference 'Document.count', -1 do
|
||||
delete :destroy, :params => {
|
||||
@@ -245,6 +246,7 @@ LOREM
|
||||
end
|
||||
|
||||
def test_add_attachment
|
||||
set_tmp_attachments_directory
|
||||
@request.session[:user_id] = 2
|
||||
assert_difference 'Attachment.count' do
|
||||
post :add_attachment, :params => {
|
||||
|
||||
@@ -348,6 +348,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
end
|
||||
|
||||
def test_index_grouped_by_due_date
|
||||
set_tmp_attachments_directory
|
||||
Issue.destroy_all
|
||||
Issue.generate!(:due_date => '2018-08-10')
|
||||
Issue.generate!(:due_date => '2018-08-10')
|
||||
@@ -4413,6 +4414,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
end
|
||||
|
||||
def test_create_as_copy_with_attachments_should_also_add_new_files
|
||||
set_tmp_attachments_directory
|
||||
@request.session[:user_id] = 2
|
||||
issue = Issue.find(3)
|
||||
count = issue.attachments.count
|
||||
@@ -6670,6 +6672,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
end
|
||||
|
||||
def test_destroy_issue_with_no_time_entries_should_delete_the_issues
|
||||
set_tmp_attachments_directory
|
||||
assert_nil TimeEntry.find_by_issue_id(2)
|
||||
@request.session[:user_id] = 2
|
||||
|
||||
@@ -6683,6 +6686,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
end
|
||||
|
||||
def test_destroy_issues_with_time_entries_should_show_the_reassign_form
|
||||
set_tmp_attachments_directory
|
||||
@request.session[:user_id] = 2
|
||||
|
||||
with_settings :timelog_required_fields => [] do
|
||||
@@ -6703,18 +6707,19 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
end
|
||||
|
||||
def test_destroy_issues_with_time_entries_should_not_show_the_nullify_option_when_issue_is_required_for_time_entries
|
||||
set_tmp_attachments_directory
|
||||
with_settings :timelog_required_fields => ['issue_id'] do
|
||||
@request.session[:user_id] = 2
|
||||
|
||||
assert_no_difference 'Issue.count' do
|
||||
delete :destroy, :params => {
|
||||
:ids => [1, 3]
|
||||
}
|
||||
end
|
||||
assert_response :success
|
||||
assert_no_difference 'Issue.count' do
|
||||
delete :destroy, :params => {
|
||||
:ids => [1, 3]
|
||||
}
|
||||
end
|
||||
assert_response :success
|
||||
|
||||
assert_select 'form' do
|
||||
assert_select 'input[name=_method][value=delete]'
|
||||
assert_select 'form' do
|
||||
assert_select 'input[name=_method][value=delete]'
|
||||
assert_select 'input[name=todo][value=destroy]'
|
||||
assert_select 'input[name=todo][value=nullify]', 0
|
||||
assert_select 'input[name=todo][value=reassign]'
|
||||
@@ -6739,6 +6744,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
end
|
||||
|
||||
def test_destroy_issues_and_destroy_time_entries
|
||||
set_tmp_attachments_directory
|
||||
@request.session[:user_id] = 2
|
||||
|
||||
assert_difference 'Issue.count', -2 do
|
||||
@@ -6755,6 +6761,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
end
|
||||
|
||||
def test_destroy_issues_and_assign_time_entries_to_project
|
||||
set_tmp_attachments_directory
|
||||
@request.session[:user_id] = 2
|
||||
|
||||
with_settings :timelog_required_fields => [] do
|
||||
@@ -6774,6 +6781,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
end
|
||||
|
||||
def test_destroy_issues_and_reassign_time_entries_to_another_issue
|
||||
set_tmp_attachments_directory
|
||||
@request.session[:user_id] = 2
|
||||
|
||||
assert_difference 'Issue.count', -2 do
|
||||
@@ -6814,6 +6822,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
end
|
||||
|
||||
def test_destroy_issues_and_reassign_time_entries_to_an_invalid_issue_should_fail
|
||||
set_tmp_attachments_directory
|
||||
@request.session[:user_id] = 2
|
||||
|
||||
assert_no_difference 'Issue.count' do
|
||||
@@ -6830,6 +6839,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
end
|
||||
|
||||
def test_destroy_issues_and_reassign_time_entries_to_an_issue_to_delete_should_fail
|
||||
set_tmp_attachments_directory
|
||||
@request.session[:user_id] = 2
|
||||
|
||||
assert_no_difference 'Issue.count' do
|
||||
@@ -6846,6 +6856,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
end
|
||||
|
||||
def test_destroy_issues_and_nullify_time_entries_should_fail_when_issue_is_required_for_time_entries
|
||||
set_tmp_attachments_directory
|
||||
@request.session[:user_id] = 2
|
||||
|
||||
with_settings :timelog_required_fields => ['issue_id'] do
|
||||
@@ -6863,6 +6874,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
end
|
||||
|
||||
def test_destroy_issues_from_different_projects
|
||||
set_tmp_attachments_directory
|
||||
@request.session[:user_id] = 2
|
||||
|
||||
assert_difference 'Issue.count', -3 do
|
||||
|
||||
@@ -62,6 +62,7 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
end
|
||||
|
||||
def test_index_should_show_visible_custom_fields_only
|
||||
set_tmp_attachments_directory
|
||||
Issue.destroy_all
|
||||
Journal.delete_all
|
||||
field_attributes = {:field_format => 'string', :is_for_all => true, :is_filter => true, :trackers => Tracker.all}
|
||||
|
||||
@@ -232,6 +232,7 @@ class MessagesControllerTest < Redmine::ControllerTest
|
||||
end
|
||||
|
||||
def test_destroy_topic
|
||||
set_tmp_attachments_directory
|
||||
@request.session[:user_id] = 2
|
||||
assert_difference 'Message.count', -3 do
|
||||
post :destroy, :params => {
|
||||
|
||||
@@ -834,6 +834,7 @@ class ProjectsControllerTest < Redmine::ControllerTest
|
||||
end
|
||||
|
||||
def test_destroy_without_confirmation_should_show_confirmation_with_subprojects
|
||||
set_tmp_attachments_directory
|
||||
@request.session[:user_id] = 1 # admin
|
||||
|
||||
assert_no_difference 'Project.count' do
|
||||
@@ -849,6 +850,7 @@ class ProjectsControllerTest < Redmine::ControllerTest
|
||||
end
|
||||
|
||||
def test_destroy_with_confirmation_should_destroy_the_project_and_subprojects
|
||||
set_tmp_attachments_directory
|
||||
@request.session[:user_id] = 1 # admin
|
||||
|
||||
assert_difference 'Project.count', -5 do
|
||||
|
||||
@@ -273,6 +273,7 @@ class WikiControllerTest < Redmine::ControllerTest
|
||||
end
|
||||
|
||||
def test_create_page_with_attachments
|
||||
set_tmp_attachments_directory
|
||||
@request.session[:user_id] = 2
|
||||
assert_difference 'WikiPage.count' do
|
||||
assert_difference 'Attachment.count' do
|
||||
@@ -443,6 +444,7 @@ class WikiControllerTest < Redmine::ControllerTest
|
||||
end
|
||||
|
||||
def test_update_page_with_attachments_only_should_not_create_content_version
|
||||
set_tmp_attachments_directory
|
||||
@request.session[:user_id] = 2
|
||||
assert_no_difference 'WikiPage.count' do
|
||||
assert_no_difference 'WikiContent.count' do
|
||||
@@ -1179,6 +1181,7 @@ class WikiControllerTest < Redmine::ControllerTest
|
||||
end
|
||||
|
||||
def test_add_attachment
|
||||
set_tmp_attachments_directory
|
||||
@request.session[:user_id] = 2
|
||||
assert_difference 'Attachment.count' do
|
||||
post :add_attachment, :params => {
|
||||
|
||||
@@ -27,6 +27,7 @@ class WikisControllerTest < Redmine::ControllerTest
|
||||
end
|
||||
|
||||
def test_get_destroy_should_ask_confirmation
|
||||
set_tmp_attachments_directory
|
||||
@request.session[:user_id] = 1
|
||||
assert_no_difference 'Wiki.count' do
|
||||
get :destroy, :params => {:id => 1}
|
||||
@@ -35,6 +36,7 @@ class WikisControllerTest < Redmine::ControllerTest
|
||||
end
|
||||
|
||||
def test_post_destroy_should_delete_wiki
|
||||
set_tmp_attachments_directory
|
||||
@request.session[:user_id] = 1
|
||||
post :destroy, :params => {:id => 1, :confirm => 1}
|
||||
assert_redirected_to :controller => 'projects',
|
||||
|
||||
@@ -190,7 +190,6 @@ RAW
|
||||
end
|
||||
|
||||
def test_attached_images_filename_extension
|
||||
set_tmp_attachments_directory
|
||||
a1 = Attachment.new(
|
||||
:container => Issue.find(1),
|
||||
:file => mock_file_with_options({:original_filename => "testtest.JPG"}),
|
||||
@@ -264,6 +263,7 @@ RAW
|
||||
}
|
||||
attachments = [a1, a2]
|
||||
to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text, :attachments => attachments) }
|
||||
ensure
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
|
||||
@@ -722,7 +722,6 @@ RAW
|
||||
end
|
||||
|
||||
def test_attachment_link_should_link_to_latest_attachment
|
||||
set_tmp_attachments_directory
|
||||
a1 = Attachment.generate!(:filename => "test.txt", :created_on => 1.hour.ago)
|
||||
a2 = Attachment.generate!(:filename => "test.txt")
|
||||
result = link_to("test.txt", "/attachments/#{a2.id}",
|
||||
|
||||
@@ -32,6 +32,7 @@ class JournalsHelperTest < Redmine::HelperTest
|
||||
:versions
|
||||
|
||||
def test_journal_thumbnail_attachments_should_return_thumbnailable_attachments
|
||||
set_tmp_attachments_directory
|
||||
issue = Issue.generate!
|
||||
|
||||
journal = new_record(Journal) do
|
||||
|
||||
@@ -152,7 +152,6 @@ class AttachmentsTest < Redmine::IntegrationTest
|
||||
get "/attachments/download/4"
|
||||
assert_response :success
|
||||
assert_not_nil response.headers["X-Sendfile"]
|
||||
|
||||
ensure
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
|
||||
@@ -149,8 +149,6 @@ class IssuesTest < ApplicationSystemTestCase
|
||||
end
|
||||
assert_equal 1, issue.attachments.count
|
||||
assert_equal 'Some description', issue.attachments.first.description
|
||||
ensure
|
||||
set_fixtures_attachments_directory
|
||||
end
|
||||
|
||||
def test_create_issue_with_new_target_version
|
||||
|
||||
@@ -344,6 +344,8 @@ class AttachmentTest < ActiveSupport::TestCase
|
||||
assert attachment.readable?
|
||||
attachment.update_digest_to_sha256!
|
||||
assert_equal 'ac5c6e99a21ae74b2e3f5b8e5b568be1b9107cd7153d139e822b9fe5caf50938', attachment.digest
|
||||
ensure
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
|
||||
def test_update_attachments
|
||||
@@ -403,7 +405,7 @@ class AttachmentTest < ActiveSupport::TestCase
|
||||
assert_equal 17, la1.id
|
||||
la2 = Attachment.latest_attach([a1, a2], "Testfile.PNG")
|
||||
assert_equal 17, la2.id
|
||||
|
||||
ensure
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
|
||||
@@ -444,6 +446,8 @@ class AttachmentTest < ActiveSupport::TestCase
|
||||
assert File.exist?(thumbnail)
|
||||
end
|
||||
end
|
||||
ensure
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
|
||||
def test_should_reuse_thumbnail
|
||||
@@ -490,6 +494,8 @@ class AttachmentTest < ActiveSupport::TestCase
|
||||
set_fixtures_attachments_directory
|
||||
attachment = Attachment.find(16)
|
||||
assert_nil attachment.thumbnail
|
||||
ensure
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
|
||||
def test_thumbnail_should_be_at_least_of_requested_size
|
||||
@@ -508,6 +514,8 @@ class AttachmentTest < ActiveSupport::TestCase
|
||||
assert_equal "8e0294de2441577c529f170b6fb8f638_2654_#{generated_size}.thumb",
|
||||
File.basename(thumbnail)
|
||||
end
|
||||
ensure
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
else
|
||||
puts '(ImageMagick convert not available)'
|
||||
|
||||
@@ -93,6 +93,7 @@ class BoardTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
def test_destroy
|
||||
set_tmp_attachments_directory
|
||||
board = Board.find(1)
|
||||
assert_difference 'Message.count', -6 do
|
||||
assert_difference 'Attachment.count', -1 do
|
||||
|
||||
@@ -69,9 +69,8 @@ class PdfTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
def test_attach
|
||||
set_fixtures_attachments_directory
|
||||
["CP932", "SJIS"].each do |encoding|
|
||||
set_fixtures_attachments_directory
|
||||
|
||||
str2 = "\x83e\x83X\x83g".b
|
||||
|
||||
a1 = Attachment.find(17)
|
||||
@@ -99,8 +98,8 @@ class PdfTest < ActiveSupport::TestCase
|
||||
assert_nil aa1
|
||||
aa2 = Redmine::Export::PDF::RDMPdfEncoding::attach(Attachment.all, "test#{str2}.png", encoding)
|
||||
assert_nil aa2
|
||||
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
ensure
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
end
|
||||
|
||||
@@ -543,6 +543,7 @@ class MailHandlerTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
def test_add_issue_from_apple_mail
|
||||
set_tmp_attachments_directory
|
||||
issue = submit_email(
|
||||
'apple_mail_with_attachment.eml',
|
||||
:issue => {:project => 'ecookbook'}
|
||||
@@ -559,6 +560,7 @@ class MailHandlerTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
def test_thunderbird_with_attachment_ja
|
||||
set_tmp_attachments_directory
|
||||
issue = submit_email(
|
||||
'thunderbird_with_attachment_ja.eml',
|
||||
:issue => {:project => 'ecookbook'}
|
||||
@@ -583,6 +585,7 @@ class MailHandlerTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
def test_gmail_with_attachment_ja
|
||||
set_tmp_attachments_directory
|
||||
issue = submit_email(
|
||||
'gmail_with_attachment_ja.eml',
|
||||
:issue => {:project => 'ecookbook'}
|
||||
@@ -598,6 +601,7 @@ class MailHandlerTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
def test_thunderbird_with_attachment_latin1
|
||||
set_tmp_attachments_directory
|
||||
issue = submit_email(
|
||||
'thunderbird_with_attachment_iso-8859-1.eml',
|
||||
:issue => {:project => 'ecookbook'}
|
||||
@@ -616,6 +620,7 @@ class MailHandlerTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
def test_gmail_with_attachment_latin1
|
||||
set_tmp_attachments_directory
|
||||
issue = submit_email(
|
||||
'gmail_with_attachment_iso-8859-1.eml',
|
||||
:issue => {:project => 'ecookbook'}
|
||||
@@ -634,6 +639,7 @@ class MailHandlerTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
def test_mail_with_attachment_latin2
|
||||
set_tmp_attachments_directory
|
||||
issue = submit_email(
|
||||
'ticket_with_text_attachment_iso-8859-2.eml',
|
||||
:issue => {:project => 'ecookbook'}
|
||||
@@ -987,6 +993,7 @@ class MailHandlerTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
def test_reply_to_a_nonexistent_issue
|
||||
set_tmp_attachments_directory
|
||||
Issue.find(2).destroy
|
||||
assert_no_difference 'Issue.count' do
|
||||
assert_no_difference 'Journal.count' do
|
||||
|
||||
@@ -108,6 +108,7 @@ class MessageTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
def test_destroy_topic
|
||||
set_tmp_attachments_directory
|
||||
message = Message.find(1)
|
||||
board = message.board
|
||||
topics_count, messages_count = board.topics_count, board.messages_count
|
||||
|
||||
@@ -55,6 +55,7 @@ class ProjectCopyTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
test "#copy should copy project attachments" do
|
||||
set_tmp_attachments_directory
|
||||
Attachment.create!(:container => @source_project, :file => uploaded_test_file("testfile.txt", "text/plain"), :author_id => 1)
|
||||
assert @project.copy(@source_project)
|
||||
|
||||
@@ -207,6 +208,7 @@ class ProjectCopyTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
test "#copy should copy issue attachments" do
|
||||
set_tmp_attachments_directory
|
||||
issue = Issue.generate!(:subject => "copy with attachment", :tracker_id => 1, :project_id => @source_project.id)
|
||||
Attachment.create!(:container => issue, :file => uploaded_test_file("testfile.txt", "text/plain"), :author_id => 1)
|
||||
@source_project.issues << issue
|
||||
@@ -296,6 +298,7 @@ class ProjectCopyTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
test "#copy should copy version attachments" do
|
||||
set_tmp_attachments_directory
|
||||
version = Version.generate!(:name => "copy with attachment")
|
||||
Attachment.create!(:container => version, :file => uploaded_test_file("testfile.txt", "text/plain"), :author_id => 1)
|
||||
@source_project.versions << version
|
||||
@@ -378,6 +381,7 @@ class ProjectCopyTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
test "#copy should copy document attachments" do
|
||||
set_tmp_attachments_directory
|
||||
document = Document.generate!(:title => "copy with attachment", :category_id => 1, :project_id => @source_project.id)
|
||||
Attachment.create!(:container => document, :file => uploaded_test_file("testfile.txt", "text/plain"), :author_id => 1)
|
||||
@source_project.documents << document
|
||||
|
||||
@@ -262,6 +262,7 @@ class UserTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
def test_destroy_should_update_attachments
|
||||
set_tmp_attachments_directory
|
||||
attachment = Attachment.create!(:container => Project.find(1),
|
||||
:file => uploaded_test_file("testfile.txt", "text/plain"),
|
||||
:author_id => 2)
|
||||
|
||||
@@ -143,6 +143,7 @@ class WikiPageTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
def test_destroy_should_delete_content_and_its_versions
|
||||
set_tmp_attachments_directory
|
||||
page = WikiPage.find(1)
|
||||
assert_difference 'WikiPage.count', -1 do
|
||||
assert_difference 'WikiContent.count', -1 do
|
||||
|
||||
@@ -103,6 +103,7 @@ class WikiTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
def test_destroy_should_remove_redirects_from_the_wiki
|
||||
set_tmp_attachments_directory
|
||||
WikiRedirect.create!(:wiki_id => 1, :title => 'Foo', :redirects_to_wiki_id => 2, :redirects_to => 'Bar')
|
||||
|
||||
Wiki.find(1).destroy
|
||||
@@ -110,6 +111,7 @@ class WikiTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
def test_destroy_should_remove_redirects_to_the_wiki
|
||||
set_tmp_attachments_directory
|
||||
WikiRedirect.create!(:wiki_id => 2, :title => 'Foo', :redirects_to_wiki_id => 1, :redirects_to => 'Bar')
|
||||
|
||||
Wiki.find(1).destroy
|
||||
|
||||
Reference in New Issue
Block a user