Skip to content

Commit 26bf853

Browse files
committed
Add test for standard_message
.. with utf-8 subject, TO header, and content.
1 parent 9b19d90 commit 26bf853

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

test/test_mailgw.py

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1613,6 +1613,61 @@ def testFollowup(self):
16131613
nosy: +john, mary
16141614
status: unread -> chatting
16151615
1616+
_______________________________________________________________________
1617+
Roundup issue tracker <[email protected]>
1618+
<http://tracker.example/cgi-bin/roundup.cgi/bugs/issue1>
1619+
_______________________________________________________________________
1620+
''')
1621+
1622+
def testFollowupUTF8(self):
1623+
self.doNewIssue()
1624+
1625+
self._handle_mail('''Content-Type: text/plain;
1626+
charset="utf-8"
1627+
Content-Transfer-Encoding: quoted-printable
1628+
From: richard <[email protected]>
1629+
1630+
Message-Id: <followup_dummy_id>
1631+
In-Reply-To: <dummy_test_message_id>
1632+
Subject: [issue1] Testing... [assignedto=mary; nosy=+john]
1633+
1634+
This is a followup with UTF-8 characters in it:
1635+
=C3=A4=C3=B6=C3=BC=C3=84=C3=96=C3=9C=C3=9F
1636+
''')
1637+
l = self.db.issue.get('1', 'nosy')
1638+
l.sort()
1639+
self.assertEqual(l, [self.chef_id, self.richard_id, self.mary_id,
1640+
self.john_id])
1641+
1642+
self.compareMessages(self._get_mail(),
1643+
1644+
1645+
Content-Type: text/plain; charset="utf-8"
1646+
Subject: [issue1] Testing...
1647+
1648+
From: richard <[email protected]>
1649+
Reply-To: Roundup issue tracker
1650+
1651+
MIME-Version: 1.0
1652+
Message-Id: <followup_dummy_id>
1653+
In-Reply-To: <dummy_test_message_id>
1654+
X-Roundup-Name: Roundup issue tracker
1655+
X-Roundup-Loop: hello
1656+
X-Roundup-Issue-Status: chatting
1657+
Content-Transfer-Encoding: quoted-printable
1658+
X-Roundup-Issue-Id: 1
1659+
1660+
1661+
richard <[email protected]> added the comment:
1662+
1663+
This is a followup with UTF-8 characters in it:
1664+
=C3=A4=C3=B6=C3=BC=C3=84=C3=96=C3=9C=C3=9F
1665+
1666+
----------
1667+
assignedto: -> mary
1668+
nosy: +john, mary
1669+
status: unread -> chatting
1670+
16161671
_______________________________________________________________________
16171672
Roundup issue tracker <[email protected]>
16181673
<http://tracker.example/cgi-bin/roundup.cgi/bugs/issue1>
@@ -4386,6 +4441,34 @@ def testForwardedMessageAttachment(self):
43864441
self.assertEqual(self.db.file.get(fileid, 'type'), 'message/rfc822')
43874442

43884443

4444+
def testStandardMsg(self):
4445+
self.instance.config['MAIL_DOMAIN'] = 'example.com'
4446+
name = u'Accented chars \xe4\xf6\xfc\xc4\xd6\xdc\xdf'
4447+
name = name.encode('utf-8')
4448+
4449+
to = [adr]
4450+
adr = (name, adr)
4451+
mailer = roundupdb.Mailer(self.db.config)
4452+
mailer.standard_message(to, name, name, author=adr)
4453+
assert os.path.exists(SENDMAILDEBUG)
4454+
self.compareMessages(self._get_mail(),
4455+
'''
4456+
4457+
4458+
From: =?utf-8?b?QWNjZW50ZWQgY2hhcnMgw6TDtsO8w4TDlsOcw58=?=
4459+
4460+
4461+
MIME-Version: 1.0
4462+
Content-Type: text/plain; charset="utf-8"
4463+
Subject: =?utf-8?b?QWNjZW50ZWQgY2hhcnMgw6TDtsO8w4TDlsOcw58=?=
4464+
X-Roundup-Name: Roundup issue tracker
4465+
X-Roundup-Loop: hello
4466+
Content-Transfer-Encoding: base64
4467+
4468+
QWNjZW50ZWQgY2hhcnMgw6TDtsO8w4TDlsOcw58=
4469+
''')
4470+
4471+
43894472
@skip_pgp
43904473
class MailgwPGPTestCase(MailgwTestAbstractBase, unittest.TestCase):
43914474
pgphome = gpgmelib.pgphome

0 commit comments

Comments
 (0)