summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2019-09-19 09:38:39 +0000
committerGo MAEDA <maeda@farend.jp>2019-09-19 09:38:39 +0000
commit75df6ead3b5340449107ab4a3effb82430685248 (patch)
tree1c3fabe65fc7ce3d79d97b50f3321604fd332253 /test/unit
parentaa8c59a38909c8c84fb70e77fdaebc9e3aaf447c (diff)
downloadredmine-75df6ead3b5340449107ab4a3effb82430685248.tar.gz
redmine-75df6ead3b5340449107ab4a3effb82430685248.zip
Log info messages when MailHandler ignored a reply to a nonexistent issue, journal, or message (#31946).
Patch by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@18480 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/mail_handler_test.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/unit/mail_handler_test.rb b/test/unit/mail_handler_test.rb
index c2d97811d..8d7b022b9 100644
--- a/test/unit/mail_handler_test.rb
+++ b/test/unit/mail_handler_test.rb
@@ -985,6 +985,29 @@ class MailHandlerTest < ActiveSupport::TestCase
end
end
+ def test_reply_to_a_nonexistent_issue
+ Issue.find(2).destroy
+ assert_no_difference 'Issue.count' do
+ assert_no_difference 'Journal.count' do
+ journal = submit_email('ticket_reply_with_status.eml')
+ assert_nil journal
+ end
+ end
+ end
+
+ def test_reply_to_a_nonexitent_journal
+ journal_id = Issue.find(2).journals.last.id
+ Journal.destroy(journal_id)
+ assert_no_difference 'Issue.count' do
+ assert_no_difference 'Journal.count' do
+ journal = submit_email('ticket_reply.eml') do |email|
+ email.sub! %r{^In-Reply-To:.*$}, "In-Reply-To: <redmine.journal-#{journal_id}.20060719210421@osiris>"
+ end
+ assert_nil journal
+ end
+ end
+ end
+
def test_reply_to_a_message
m = submit_email('message_reply.eml')
assert m.is_a?(Message)
@@ -1015,6 +1038,14 @@ class MailHandlerTest < ActiveSupport::TestCase
end
end
+ def test_reply_to_a_nonexistent_topic
+ Message.find(2).destroy
+ assert_no_difference('Message.count') do
+ m = submit_email('message_reply_by_subject.eml')
+ assert_nil m
+ end
+ end
+
def test_should_convert_tags_of_html_only_emails
with_settings :text_formatting => 'textile' do
issue = submit_email('ticket_html_only.eml', :issue => {:project => 'ecookbook'})