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.
This commit is contained in:
Maurits van Rees 2020-09-23 15:35:32 +02:00
parent e4bcf2f53c
commit c9d9cfca04
No known key found for this signature in database
GPG Key ID: AAEC1E5318E6FCCE

View File

@ -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