From e4bcf2f53c19af9bb7d5d8b5b5e173fc6c3b50c5 Mon Sep 17 00:00:00 2001 From: Maurits van Rees Date: Wed, 23 Sep 2020 15:26:30 +0200 Subject: [PATCH] Fix tests with Products.MailHost 4.10. --- news/3178.bugfix | 2 ++ plone/app/discussion/tests/test_notifications.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 news/3178.bugfix diff --git a/news/3178.bugfix b/news/3178.bugfix new file mode 100644 index 0000000..c62697d --- /dev/null +++ b/news/3178.bugfix @@ -0,0 +1,2 @@ +Fix tests with Products.MailHost 4.10. +[maurits] diff --git a/plone/app/discussion/tests/test_notifications.py b/plone/app/discussion/tests/test_notifications.py index 16844e2..dabed0e 100644 --- a/plone/app/discussion/tests/test_notifications.py +++ b/plone/app/discussion/tests/test_notifications.py @@ -65,7 +65,8 @@ class TestUserNotificationUnit(unittest.TestCase): self.assertEqual(len(self.mailhost.messages), 1) self.assertTrue(self.mailhost.messages[0]) - msg = str(self.mailhost.messages[0]) + msg = self.mailhost.messages[0] + msg = msg.decode("utf-8") self.assertTrue('To: john@plone.test' in msg) self.assertTrue('From: portal@plone.test' in msg) # We expect the headers to be properly header encoded (7-bit): @@ -207,6 +208,7 @@ class TestModeratorNotificationUnit(unittest.TestCase): self.assertEqual(len(self.mailhost.messages), 1) self.assertTrue(self.mailhost.messages[0]) msg = self.mailhost.messages[0] + msg = msg.decode("utf-8") self.assertTrue('To: portal@plone.test' in msg) self.assertTrue('From: portal@plone.test' in msg) # We expect the headers to be properly header encoded (7-bit): @@ -244,6 +246,7 @@ class TestModeratorNotificationUnit(unittest.TestCase): self.assertEqual(len(self.mailhost.messages), 1) msg = self.mailhost.messages[0] + msg = msg.decode("utf-8") if not isinstance(msg, str): self.assertTrue('test@example.com' in msg.mto) else: