Patch #32122 ยป add_call_to_set_tmp_attachments_directory.patch
| test/functional/documents_controller_test.rb | ||
|---|---|---|
|
end
|
||
|
def test_destroy
|
||
|
set_tmp_attachments_directory
|
||
|
@request.session[:user_id] = 2
|
||
|
assert_difference 'Document.count', -1 do
|
||
|
delete :destroy, :params => {
|
||
| ... | ... | |
|
end
|
||
|
def test_add_attachment
|
||
|
set_tmp_attachments_directory
|
||
|
@request.session[:user_id] = 2
|
||
|
assert_difference 'Attachment.count' do
|
||
|
post :add_attachment, :params => {
|
||
| test/functional/issues_controller_test.rb | ||
|---|---|---|
|
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')
|
||
| ... | ... | |
|
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
|
||
| ... | ... | |
|
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
|
||
| ... | ... | |
|
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
|
||
| ... | ... | |
|
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]'
|
||
| ... | ... | |
|
end
|
||
|
def test_destroy_issues_and_destroy_time_entries
|
||
|
set_tmp_attachments_directory
|
||
|
@request.session[:user_id] = 2
|
||
|
assert_difference 'Issue.count', -2 do
|
||
| ... | ... | |
|
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
|
||
| ... | ... | |
|
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
|
||
| ... | ... | |
|
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
|
||
| ... | ... | |
|
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
|
||
| ... | ... | |
|
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
|
||
| ... | ... | |
|
end
|
||
|
def test_destroy_issues_from_different_projects
|
||
|
set_tmp_attachments_directory
|
||
|
@request.session[:user_id] = 2
|
||
|
assert_difference 'Issue.count', -3 do
|
||
| test/functional/journals_controller_test.rb | ||
|---|---|---|
|
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}
|
||
| test/functional/messages_controller_test.rb | ||
|---|---|---|
|
end
|
||
|
def test_destroy_topic
|
||
|
set_tmp_attachments_directory
|
||
|
@request.session[:user_id] = 2
|
||
|
assert_difference 'Message.count', -3 do
|
||
|
post :destroy, :params => {
|
||
| test/functional/projects_controller_test.rb | ||
|---|---|---|
|
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
|
||
| ... | ... | |
|
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
|
||
| test/functional/wiki_controller_test.rb | ||
|---|---|---|
|
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
|
||
| ... | ... | |
|
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
|
||
| ... | ... | |
|
end
|
||
|
def test_add_attachment
|
||
|
set_tmp_attachments_directory
|
||
|
@request.session[:user_id] = 2
|
||
|
assert_difference 'Attachment.count' do
|
||
|
post :add_attachment, :params => {
|
||
| test/functional/wikis_controller_test.rb | ||
|---|---|---|
|
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}
|
||
| ... | ... | |
|
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',
|
||
| test/helpers/application_helper_test.rb | ||
|---|---|---|
|
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"}),
|
||
| ... | ... | |
|
}
|
||
|
attachments = [a1, a2]
|
||
|
to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text, :attachments => attachments) }
|
||
|
ensure
|
||
|
set_tmp_attachments_directory
|
||
|
end
|
||
| ... | ... | |
|
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}",
|
||
| test/helpers/journals_helper_test.rb | ||
|---|---|---|
|
:versions
|
||
|
def test_journal_thumbnail_attachments_should_return_thumbnailable_attachments
|
||
|
set_tmp_attachments_directory
|
||
|
issue = Issue.generate!
|
||
|
journal = new_record(Journal) do
|
||
| test/integration/attachments_test.rb | ||
|---|---|---|
|
get "/attachments/download/4"
|
||
|
assert_response :success
|
||
|
assert_not_nil response.headers["X-Sendfile"]
|
||
|
ensure
|
||
|
set_tmp_attachments_directory
|
||
|
end
|
||
| test/system/issues_test.rb | ||
|---|---|---|
|
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
|
||
| test/unit/attachment_test.rb | ||
|---|---|---|
|
assert attachment.readable?
|
||
|
attachment.update_digest_to_sha256!
|
||
|
assert_equal 'ac5c6e99a21ae74b2e3f5b8e5b568be1b9107cd7153d139e822b9fe5caf50938', attachment.digest
|
||
|
ensure
|
||
|
set_tmp_attachments_directory
|
||
|
end
|
||
|
def test_update_attachments
|
||
| ... | ... | |
|
assert_equal 17, la1.id
|
||
|
la2 = Attachment.latest_attach([a1, a2], "Testfile.PNG")
|
||
|
assert_equal 17, la2.id
|
||
|
ensure
|
||
|
set_tmp_attachments_directory
|
||
|
end
|
||
| ... | ... | |
|
assert File.exist?(thumbnail)
|
||
|
end
|
||
|
end
|
||
|
ensure
|
||
|
set_tmp_attachments_directory
|
||
|
end
|
||
|
def test_should_reuse_thumbnail
|
||
| ... | ... | |
|
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
|
||
| ... | ... | |
|
assert_equal "8e0294de2441577c529f170b6fb8f638_2654_#{generated_size}.thumb",
|
||
|
File.basename(thumbnail)
|
||
|
end
|
||
|
ensure
|
||
|
set_tmp_attachments_directory
|
||
|
end
|
||
|
else
|
||
|
puts '(ImageMagick convert not available)'
|
||
| test/unit/board_test.rb | ||
|---|---|---|
|
end
|
||
|
def test_destroy
|
||
|
set_tmp_attachments_directory
|
||
|
board = Board.find(1)
|
||
|
assert_difference 'Message.count', -6 do
|
||
|
assert_difference 'Attachment.count', -1 do
|
||
| test/unit/lib/redmine/export/pdf_test.rb | ||
|---|---|---|
|
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)
|
||
| ... | ... | |
|
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
|
||
| test/unit/mail_handler_test.rb | ||
|---|---|---|
|
end
|
||
|
def test_add_issue_from_apple_mail
|
||
|
set_tmp_attachments_directory
|
||
|
issue = submit_email(
|
||
|
'apple_mail_with_attachment.eml',
|
||
|
:issue => {:project => 'ecookbook'}
|
||
| ... | ... | |
|
end
|
||
|
def test_thunderbird_with_attachment_ja
|
||
|
set_tmp_attachments_directory
|
||
|
issue = submit_email(
|
||
|
'thunderbird_with_attachment_ja.eml',
|
||
|
:issue => {:project => 'ecookbook'}
|
||
| ... | ... | |
|
end
|
||
|
def test_gmail_with_attachment_ja
|
||
|
set_tmp_attachments_directory
|
||
|
issue = submit_email(
|
||
|
'gmail_with_attachment_ja.eml',
|
||
|
:issue => {:project => 'ecookbook'}
|
||
| ... | ... | |
|
end
|
||
|
def test_thunderbird_with_attachment_latin1
|
||
|
set_tmp_attachments_directory
|
||
|
issue = submit_email(
|
||
|
'thunderbird_with_attachment_iso-8859-1.eml',
|
||
|
:issue => {:project => 'ecookbook'}
|
||
| ... | ... | |
|
end
|
||
|
def test_gmail_with_attachment_latin1
|
||
|
set_tmp_attachments_directory
|
||
|
issue = submit_email(
|
||
|
'gmail_with_attachment_iso-8859-1.eml',
|
||
|
:issue => {:project => 'ecookbook'}
|
||
| ... | ... | |
|
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'}
|
||
| ... | ... | |
|
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
|
||
| test/unit/message_test.rb | ||
|---|---|---|
|
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
|
||
| test/unit/project_copy_test.rb | ||
|---|---|---|
|
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)
|
||
| ... | ... | |
|
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
|
||
| ... | ... | |
|
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
|
||
| ... | ... | |
|
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
|
||
| test/unit/user_test.rb | ||
|---|---|---|
|
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)
|
||
| test/unit/wiki_page_test.rb | ||
|---|---|---|
|
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
|
||
| test/unit/wiki_test.rb | ||
|---|---|---|
|
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
|
||
| ... | ... | |
|
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
|
||