diff options
author | Eric Davis <edavis@littlestreamsoftware.com> | 2008-08-20 06:21:06 +0000 |
---|---|---|
committer | Eric Davis <edavis@littlestreamsoftware.com> | 2008-08-20 06:21:06 +0000 |
commit | 2f3f2d8b12483b72f78f7f4704d8641451b16832 (patch) | |
tree | 98742d143b5e0ce8a89278e7f638af387fc3d200 /test | |
parent | 6db8fa8ef762bafb09ce1c2419a8392e119caece (diff) | |
download | redmine-2f3f2d8b12483b72f78f7f4704d8641451b16832.tar.gz redmine-2f3f2d8b12483b72f78f7f4704d8641451b16832.zip |
Added the "Status:" keyword to the MailHandler for setting and changing an Issue status via email.
#1669
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1751 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/fixtures/mail_handler/ticket_on_given_project.eml | 1 | ||||
-rw-r--r-- | test/fixtures/mail_handler/ticket_reply_with_status.eml | 75 | ||||
-rw-r--r-- | test/unit/mail_handler_test.rb | 23 |
3 files changed, 98 insertions, 1 deletions
diff --git a/test/fixtures/mail_handler/ticket_on_given_project.eml b/test/fixtures/mail_handler/ticket_on_given_project.eml index 07c7f16b2..927dbc63e 100644 --- a/test/fixtures/mail_handler/ticket_on_given_project.eml +++ b/test/fixtures/mail_handler/ticket_on_given_project.eml @@ -38,4 +38,5 @@ massa. Sed sodales, ante fermentum ultricies sollicitudin, massa leo pulvinar dui, a gravida orci mi eget odio. Nunc a lacus.
Project: onlinestore
+Status: Resolved
diff --git a/test/fixtures/mail_handler/ticket_reply_with_status.eml b/test/fixtures/mail_handler/ticket_reply_with_status.eml new file mode 100644 index 000000000..ab799198b --- /dev/null +++ b/test/fixtures/mail_handler/ticket_reply_with_status.eml @@ -0,0 +1,75 @@ +Return-Path: <jsmith@somenet.foo> +Received: from osiris ([127.0.0.1]) + by OSIRIS + with hMailServer ; Sat, 21 Jun 2008 18:41:39 +0200 +Message-ID: <006a01c8d3bd$ad9baec0$0a00a8c0@osiris> +From: "John Smith" <jsmith@somenet.foo> +To: <redmine@somenet.foo> +References: <485d0ad366c88_d7014663a025f@osiris.tmail> +Subject: Re: [Cookbook - Feature #2] (New) Add ingredients categories +Date: Sat, 21 Jun 2008 18:41:39 +0200 +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_NextPart_000_0067_01C8D3CE.711F9CC0" +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 + +This is a multi-part message in MIME format. + +------=_NextPart_000_0067_01C8D3CE.711F9CC0 +Content-Type: text/plain; + charset="utf-8" +Content-Transfer-Encoding: quoted-printable + +This is reply + +Status: Resolved +------=_NextPart_000_0067_01C8D3CE.711F9CC0 +Content-Type: text/html; + charset="utf-8" +Content-Transfer-Encoding: quoted-printable + +=EF=BB=BF<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<HTML><HEAD> +<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dutf-8"> +<STYLE>BODY { + FONT-SIZE: 0.8em; COLOR: #484848; FONT-FAMILY: Verdana, sans-serif +} +BODY H1 { + FONT-SIZE: 1.2em; MARGIN: 0px; FONT-FAMILY: "Trebuchet MS", Verdana, = +sans-serif +} +A { + COLOR: #2a5685 +} +A:link { + COLOR: #2a5685 +} +A:visited { + COLOR: #2a5685 +} +A:hover { + COLOR: #c61a1a +} +A:active { + COLOR: #c61a1a +} +HR { + BORDER-RIGHT: 0px; BORDER-TOP: 0px; BACKGROUND: #ccc; BORDER-LEFT: 0px; = +WIDTH: 100%; BORDER-BOTTOM: 0px; HEIGHT: 1px +} +.footer { + FONT-SIZE: 0.8em; FONT-STYLE: italic +} +</STYLE> + +<META content=3D"MSHTML 6.00.2900.2883" name=3DGENERATOR></HEAD> +<BODY bgColor=3D#ffffff> +<DIV><SPAN class=3Dfooter><FONT face=3DArial color=3D#000000 = +size=3D2>This is=20 +reply Status: Resolved</FONT></DIV></SPAN></BODY></HTML> + +------=_NextPart_000_0067_01C8D3CE.711F9CC0-- + diff --git a/test/unit/mail_handler_test.rb b/test/unit/mail_handler_test.rb index 6e8a47c35..b3628e0d5 100644 --- a/test/unit/mail_handler_test.rb +++ b/test/unit/mail_handler_test.rb @@ -45,6 +45,16 @@ class MailHandlerTest < Test::Unit::TestCase assert_equal Project.find(2), issue.project assert issue.description.include?('Lorem ipsum dolor sit amet, consectetuer adipiscing elit.') end + + def test_add_issue_with_status + # This email contains: 'Project: onlinestore' and 'Status: Resolved' + issue = submit_email('ticket_on_given_project.eml') + assert issue.is_a?(Issue) + assert !issue.new_record? + issue.reload + assert_equal Project.find(2), issue.project + assert_equal IssueStatus.find_by_name("Resolved"), issue.status + end def test_add_issue_with_attributes_override issue = submit_email('ticket_with_attributes.eml', :allow_override => 'tracker,category,priority') @@ -95,7 +105,18 @@ class MailHandlerTest < Test::Unit::TestCase assert journal.is_a?(Journal) assert_equal User.find_by_login('jsmith'), journal.user assert_equal Issue.find(2), journal.journalized - assert_equal 'This is reply', journal.notes + assert_match /This is reply/, journal.notes + end + + def test_add_issue_note_with_status_change + # This email contains: 'Status: Resolved' + journal = submit_email('ticket_reply_with_status.eml') + assert journal.is_a?(Journal) + issue = Issue.find(journal.issue.id) + assert_equal User.find_by_login('jsmith'), journal.user + assert_equal Issue.find(2), journal.journalized + assert_match /This is reply/, journal.notes + assert_equal IssueStatus.find_by_name("Resolved"), issue.status end private |