diff options
author | Go MAEDA <maeda@farend.jp> | 2024-07-14 01:49:53 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2024-07-14 01:49:53 +0000 |
commit | 6c8b04d6d5cf5f25ddd99a5cedb095f776a524dd (patch) | |
tree | 3ed691dc0577f84667c2da224d63a937405c95c6 /test/functional | |
parent | 6322650728c8c642ee370f45c4f118896fd6f0c8 (diff) | |
download | redmine-6c8b04d6d5cf5f25ddd99a5cedb095f776a524dd.tar.gz redmine-6c8b04d6d5cf5f25ddd99a5cedb095f776a524dd.zip |
Add configurable setting for copying attachments when copying an issue (#36197).
Patch by Yuichi HARADA (user:yui.har).
git-svn-id: https://svn.redmine.org/redmine/trunk@22926 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/issues_controller_test.rb | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 44ad19f22..3b7521d40 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -5624,6 +5624,47 @@ class IssuesControllerTest < Redmine::ControllerTest end end + def test_create_as_copy_should_always_copy_attachments_by_settings + assert_equal 4, Issue.find(3).attachments.size + with_settings :copy_attachments_on_issue_copy => 'yes' do + @request.session[:user_id] = 2 + assert_difference 'Issue.count' do + assert_difference 'Attachment.count', 4 do + post( + :create, + :params => { + :project_id => 1, + :copy_from => 3, + :issue => { + :subject => 'Copy' + } + } + ) + end + end + end + end + + def test_create_as_copy_should_never_copy_attachments_by_settings + with_settings :copy_attachments_on_issue_copy => 'no' do + @request.session[:user_id] = 2 + assert_difference 'Issue.count' do + assert_no_difference 'Attachment.count' do + post( + :create, + :params => { + :project_id => 1, + :copy_from => 3, + :issue => { + :subject => 'Copy' + } + } + ) + end + end + end + end + def test_create_as_copy_should_copy_subtasks @request.session[:user_id] = 2 issue = Issue.generate_with_descendants! @@ -8085,6 +8126,47 @@ class IssuesControllerTest < Redmine::ControllerTest end end + def test_bulk_copy_should_never_copy_attachments_by_settings + with_settings :copy_attachments_on_issue_copy => 'no' do + @request.session[:user_id] = 2 + assert_difference 'Issue.count' do + assert_no_difference 'Attachment.count' do + post( + :bulk_update, + :params => { + :ids => [3], + :copy => '1', + :issue => { + :project_id => '' + } + } + ) + end + end + end + end + + def test_bulk_copy_should_always_copy_attachments_by_settings + assert_equal 4, Issue.find(3).attachments.size + with_settings :copy_attachments_on_issue_copy => 'yes' do + @request.session[:user_id] = 2 + assert_difference 'Issue.count' do + assert_difference 'Attachment.count', 4 do + post( + :bulk_update, + :params => { + :ids => [3], + :copy => '1', + :issue => { + :project_id => '' + } + } + ) + end + end + end + end + def test_bulk_copy_should_add_relations_with_copied_issues @request.session[:user_id] = 2 assert_difference 'Issue.count', 2 do |