Fix tests with Products.MailHost 4.11.
Fixes https://github.com/plone/plone.app.discussion/issues/174
This commit is contained in:
parent
dd7865bdd6
commit
4d36d0b342
2
news/174.bugfix
Normal file
2
news/174.bugfix
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Fix tests with Products.MailHost 4.11.
|
||||||
|
[maurits]
|
@ -67,23 +67,26 @@ class TestUserNotificationUnit(unittest.TestCase):
|
|||||||
self.assertTrue(self.mailhost.messages[0])
|
self.assertTrue(self.mailhost.messages[0])
|
||||||
msg = self.mailhost.messages[0]
|
msg = self.mailhost.messages[0]
|
||||||
msg = msg.decode("utf-8")
|
msg = msg.decode("utf-8")
|
||||||
self.assertTrue('To: john@plone.test' in msg)
|
self.assertIn('To: john@plone.test', msg)
|
||||||
self.assertTrue('From: portal@plone.test' in msg)
|
self.assertIn('From: portal@plone.test', msg)
|
||||||
# We expect the headers to be properly header encoded (7-bit):
|
# We expect the headers to be properly header encoded (7-bit):
|
||||||
self.assertTrue(
|
self.assertIn(
|
||||||
'Subject: =?utf-8?q?A_comment_has_been_posted=2E?=\n'
|
'Subject: =?utf-8?q?A_comment_has_been_posted=2E?=',
|
||||||
in msg)
|
msg)
|
||||||
# The output should be encoded in a reasonable manner
|
# The output should be encoded in a reasonable manner
|
||||||
# (in this case quoted-printable):
|
# (in this case quoted-printable).
|
||||||
self.assertTrue(
|
# Depending on which Python version and which Products.MailHost version,
|
||||||
'A comment on "K=C3=B6lle Alaaf" has been posted here:'
|
# you may get lines separated by '\n' or '\r\n' in here.
|
||||||
in msg)
|
msg = msg.replace('\r\n', '\n')
|
||||||
self.assertTrue(
|
self.assertIn(
|
||||||
'http://nohost/plone/d=\noc1/view#{0}'.format(comment_id)
|
'A comment on "K=C3=B6lle Alaaf" has been posted here:',
|
||||||
in msg)
|
msg)
|
||||||
self.assertTrue('Comment text' in msg)
|
self.assertIn(
|
||||||
self.assertFalse('Approve comment' in msg)
|
'http://nohost/plone/d=\noc1/view#{0}'.format(comment_id),
|
||||||
self.assertFalse('Delete comment' in msg)
|
msg)
|
||||||
|
self.assertIn('Comment text', msg)
|
||||||
|
self.assertNotIn('Approve comment', msg)
|
||||||
|
self.assertNotIn('Delete comment', msg)
|
||||||
|
|
||||||
def test_do_not_notify_user_when_notification_is_disabled(self):
|
def test_do_not_notify_user_when_notification_is_disabled(self):
|
||||||
registry = queryUtility(IRegistry)
|
registry = queryUtility(IRegistry)
|
||||||
@ -213,7 +216,7 @@ class TestModeratorNotificationUnit(unittest.TestCase):
|
|||||||
self.assertTrue('From: portal@plone.test' in msg)
|
self.assertTrue('From: portal@plone.test' in msg)
|
||||||
# We expect the headers to be properly header encoded (7-bit):
|
# We expect the headers to be properly header encoded (7-bit):
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
'Subject: =?utf-8?q?A_comment_has_been_posted=2E?=\n'
|
'Subject: =?utf-8?q?A_comment_has_been_posted=2E?='
|
||||||
in msg)
|
in msg)
|
||||||
# The output should be encoded in a reasonable manner
|
# The output should be encoded in a reasonable manner
|
||||||
# (in this case quoted-printable):
|
# (in this case quoted-printable):
|
||||||
|
Loading…
Reference in New Issue
Block a user