summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2019-05-09 22:30:29 +0000
committerGo MAEDA <maeda@farend.jp>2019-05-09 22:30:29 +0000
commit143c359d90864615cf4b36ae8d1c78b6c595dca8 (patch)
treeaa59469f080ec8c0344abdf3d72df48bf1bc6a37 /test
parentae24985e0303c134fb1377f1cd1427dd4da7ba9c (diff)
downloadredmine-143c359d90864615cf4b36ae8d1c78b6c595dca8.tar.gz
redmine-143c359d90864615cf4b36ae8d1c78b6c595dca8.zip
Allows setting the private flag via mail keyword (#31324).
Patch by Jens Krämer. git-svn-id: http://svn.redmine.org/redmine/trunk@18150 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/mail_handler/ticket_with_localized_private_flag.eml41
-rw-r--r--test/unit/mail_handler_test.rb15
2 files changed, 56 insertions, 0 deletions
diff --git a/test/fixtures/mail_handler/ticket_with_localized_private_flag.eml b/test/fixtures/mail_handler/ticket_with_localized_private_flag.eml
new file mode 100644
index 000000000..6852b33be
--- /dev/null
+++ b/test/fixtures/mail_handler/ticket_with_localized_private_flag.eml
@@ -0,0 +1,41 @@
+Return-Path: <jsmith@somenet.foo>
+Received: from osiris ([127.0.0.1])
+ by OSIRIS
+ with hMailServer ; Sun, 22 Jun 2008 12:28:07 +0200
+Message-ID: <000501c8d452$a95cd7e0$0a00a8c0@osiris>
+From: "John Smith" <jsmith@somenet.foo>
+To: <redmine@somenet.foo>
+Subject: New ticket on a given project
+Date: Sun, 22 Jun 2008 12:28:07 +0200
+MIME-Version: 1.0
+Content-Type: text/plain;
+ format=flowed;
+ charset="iso-8859-1";
+ reply-type=original
+Content-Transfer-Encoding: 7bit
+X-Priority: 3
+X-MSMail-Priority: Normal
+X-Mailer: Microsoft Outlook Express 6.00.2900.2869
+X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869
+
+Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas imperdiet
+turpis et odio. Integer eget pede vel dolor euismod varius. Phasellus
+blandit eleifend augue. Nulla facilisi. Duis id diam. Class aptent taciti
+sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In
+in urna sed tellus aliquet lobortis. Morbi scelerisque tortor in dolor. Cras
+sagittis odio eu lacus. Aliquam sem tortor, consequat sit amet, vestibulum
+id, iaculis at, lectus. Fusce tortor libero, congue ut, euismod nec, luctus
+eget, eros. Pellentesque tortor enim, feugiat in, dignissim eget, tristique
+sed, mauris. Pellentesque habitant morbi tristique senectus et netus et
+malesuada fames ac turpis egestas. Quisque sit amet libero. In hac habitasse
+platea dictumst.
+
+Nulla et nunc. Duis pede. Donec et ipsum. Nam ut dui tincidunt neque
+sollicitudin iaculis. Duis vitae dolor. Vestibulum eget massa. Sed lorem.
+Nullam volutpat cursus erat. Cras felis dolor, lacinia quis, rutrum et,
+dictum et, ligula. Sed erat nibh, gravida in, accumsan non, placerat sed,
+massa. Sed sodales, ante fermentum ultricies sollicitudin, massa leo
+pulvinar dui, a gravida orci mi eget odio. Nunc a lacus.
+
+Projet: onlinestore
+Privée: oui
diff --git a/test/unit/mail_handler_test.rb b/test/unit/mail_handler_test.rb
index 8a4978294..61b60434f 100644
--- a/test/unit/mail_handler_test.rb
+++ b/test/unit/mail_handler_test.rb
@@ -496,6 +496,21 @@ class MailHandlerTest < ActiveSupport::TestCase
assert_equal 'ecookbook', issue.project.identifier
end
+ def test_add_issue_with_private_keyword
+ User.find_by_mail('jsmith@somenet.foo').update_attribute 'language', 'fr'
+ # give the user permission to set issues private:
+ MemberRole.create! member_id: 3, role_id: 1
+ issue = submit_email(
+ 'ticket_with_localized_private_flag.eml',
+ :allow_override => 'is_private,tracker,category,priority'
+ )
+ assert issue.is_a?(Issue)
+ refute issue.new_record?
+ issue.reload
+ assert_equal 'New ticket on a given project', issue.subject
+ assert issue.is_private
+ end
+
def test_add_issue_with_localized_attributes
User.find_by_mail('jsmith@somenet.foo').update_attribute 'language', 'fr'
issue = submit_email(