summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2019-05-10 00:54:52 +0000
committerGo MAEDA <maeda@farend.jp>2019-05-10 00:54:52 +0000
commita1c40d146a27871bc0621850750fc487eada250b (patch)
treee4b116c09c361da3e0aa278cf0e123c246fb9838 /test
parent1727950c18c83eb2189fbafe2363c9c2f322eead (diff)
downloadredmine-a1c40d146a27871bc0621850750fc487eada250b.tar.gz
redmine-a1c40d146a27871bc0621850750fc487eada250b.zip
Option to send email notifications while importing issues from CSV files (#22771).
Patch by Yuichi HARADA. git-svn-id: http://svn.redmine.org/redmine/trunk@18153 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/functional/imports_controller_test.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/functional/imports_controller_test.rb b/test/functional/imports_controller_test.rb
index 85645e24c..f75156379 100644
--- a/test/functional/imports_controller_test.rb
+++ b/test/functional/imports_controller_test.rb
@@ -237,6 +237,44 @@ class ImportsControllerTest < Redmine::ControllerTest
assert_equal ["Child of existing issue", "Child 1", "First"], issues.map(&:subject)
end
+ def test_post_run_with_notifications
+ import = generate_import
+
+ post :settings, :params => {
+ :id => import,
+ :import_settings => {
+ :separator => ';',
+ :wrapper => '"',
+ :encoding => 'ISO-8859-1',
+ :notifications => '1',
+ :mapping => {
+ :project_id => '1',
+ :tracker => '13',
+ :subject => '1',
+ :assigned_to => '11',
+ },
+ },
+ }
+
+ ActionMailer::Base.deliveries.clear
+ assert_difference 'Issue.count', 3 do
+ post :run, :params => {
+ :id => import,
+ }
+ assert_response :found
+ end
+ actual_email_count = ActionMailer::Base.deliveries.size
+ assert_not_equal 0, actual_email_count
+
+ import.reload
+ issue_ids = import.items.collect(&:obj_id)
+ expected_email_count =
+ Issue.where(:id => issue_ids).inject(0) do |sum, issue|
+ sum + (issue.notified_users | issue.notified_watchers).size
+ end
+ assert_equal expected_email_count, actual_email_count
+ end
+
def test_show_without_errors
import = generate_import_with_mapping
import.run