From c9d9cfca04862bd3ae5defaeca63d274cb07473e Mon Sep 17 00:00:00 2001 From: Maurits van Rees Date: Wed, 23 Sep 2020 15:35:32 +0200 Subject: [PATCH] Message test: we never get a Message object, but always bytes/string/unicode. Which type we get back, depends on the Python version and the Products.MailHost version. --- plone/app/discussion/tests/test_notifications.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/plone/app/discussion/tests/test_notifications.py b/plone/app/discussion/tests/test_notifications.py index dabed0e..9ed3492 100644 --- a/plone/app/discussion/tests/test_notifications.py +++ b/plone/app/discussion/tests/test_notifications.py @@ -247,10 +247,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: - self.assertTrue('To: test@example.com' in msg) + self.assertTrue('To: test@example.com' in msg) def test_do_not_notify_moderator_when_no_sender_is_available(self): # Set sender mail address to nonw and make sure no email is send to the