##// END OF EJS Templates
add test which ensure received mail text attachment keeps original encoding (#21742)...
Toshi MARUYAMA -
r14801:e28cc10a35a9
parent child
Show More
@@ -0,0 +1,31
1 Date: Thu, 14 Jan 2016 18:32:45 +0100
2 From: John Smith <JSmith@somenet.foo>
3 To: redmine@somenet.foo
4 Message-ID: <7A3.L9Yi.1Ki1}PMZiV5.1Mbzkz@seznam.cz>
5 Subject: issue #21742
6 Mime-Version: 1.0
7 Content-Type: multipart/mixed;
8 boundary="=_08d580646981073f1a667ba3=898e56d9-3d29-5ed2-9c9a-cc3a5d9474b5_=";
9 charset=UTF-8
10 Content-Transfer-Encoding: 7bit
11 X-Mailer: szn-ebox-4.5.88
12
13
14 --=_08d580646981073f1a667ba3=898e56d9-3d29-5ed2-9c9a-cc3a5d9474b5_=
15 Content-Type: text/plain;
16 charset=utf-8
17 Content-Transfer-Encoding: base64
18
19
20 --=_08d580646981073f1a667ba3=898e56d9-3d29-5ed2-9c9a-cc3a5d9474b5_=
21 Content-Type: text/plain;
22 charset=UTF-8;
23 name=latin2.txt
24 Content-Transfer-Encoding: quoted-printable
25 Content-Disposition: attachment;
26 filename=latin2.txt;
27 size=19
28
29 p=F8=EDli=B9 =BEluou=E8k=FD k=F9n=
30
31 --=_08d580646981073f1a667ba3=898e56d9-3d29-5ed2-9c9a-cc3a5d9474b5_=--
@@ -578,6 +578,22 class MailHandlerTest < ActiveSupport::TestCase
578 assert_equal 'd8e8fca2dc0f896fd7cb4cb0031ba249', attachment.digest
578 assert_equal 'd8e8fca2dc0f896fd7cb4cb0031ba249', attachment.digest
579 end
579 end
580
580
581 def test_mail_with_attachment_latin2
582 issue = submit_email(
583 'ticket_with_text_attachment_iso-8859-2.eml',
584 :issue => {:project => 'ecookbook'}
585 )
586 assert_kind_of Issue, issue
587 assert_equal 1, issue.attachments.size
588 attachment = issue.attachments.first
589 assert_equal 'latin2.txt', attachment.filename
590 assert_equal 19, attachment.filesize
591 assert File.exist?(attachment.diskfile)
592 assert_equal 19, File.size(attachment.diskfile)
593 content = "p\xF8\xEDli\xB9 \xBEluou\xE8k\xFD k\xF9n".force_encoding('CP852')
594 assert_equal content, File.read(attachment.diskfile).force_encoding('CP852')
595 end
596
581 def test_multiple_inline_text_parts_should_be_appended_to_issue_description
597 def test_multiple_inline_text_parts_should_be_appended_to_issue_description
582 issue = submit_email('multiple_text_parts.eml', :issue => {:project => 'ecookbook'})
598 issue = submit_email('multiple_text_parts.eml', :issue => {:project => 'ecookbook'})
583 assert_include 'first', issue.description
599 assert_include 'first', issue.description
General Comments 0
You need to be logged in to leave comments. Login now