Commit bfeec2da authored by Yusei Tahara's avatar Yusei Tahara

Fixed test to extract text/html message from mail message.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21449 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3ff9c0e6
...@@ -79,7 +79,7 @@ def decode_email(file): ...@@ -79,7 +79,7 @@ def decode_email(file):
# so we ignore this one to avoid doubling # so we ignore this one to avoid doubling
elif content_type == 'message/rfc822': elif content_type == 'message/rfc822':
continue continue
elif content_type == "text/plain": elif content_type in ("text/plain", "text/html"):
charset = part.get_content_charset() charset = part.get_content_charset()
payload = part.get_payload(decode=True) payload = part.get_payload(decode=True)
#LOG('CMFMailIn -> ',0,'charset: %s, payload: %s' % (charset,payload)) #LOG('CMFMailIn -> ',0,'charset: %s, payload: %s' % (charset,payload))
...@@ -539,9 +539,7 @@ Yes, I will go. ...@@ -539,9 +539,7 @@ Yes, I will go.
Check that if notification format is html. Check that if notification format is html.
""" """
message = """\ message = """<a href="http://www.erp5.com/">Click Here!!</a>"""
<a href="http://www.erp5.com/">Click Here!!</a>
"""
self.portal.portal_notifications.sendMessage( self.portal.portal_notifications.sendMessage(
recipient='userA', subject='Subject', recipient='userA', subject='Subject',
...@@ -557,7 +555,7 @@ Yes, I will go. ...@@ -557,7 +555,7 @@ Yes, I will go.
# #
# Without CRM, it does not support HTML mail. # Without CRM, it does not support HTML mail.
# #
self.assertEquals(mail_dict['body'], 'Click Here!!\n') self.assertEquals(mail_dict['body'], 'Click Here!!')
self.assertSameSet([], mail_dict['attachment_list']) self.assertSameSet([], mail_dict['attachment_list'])
def test_12_HtmlMessage(self, quiet=quiet, run=run_all_test): def test_12_HtmlMessage(self, quiet=quiet, run=run_all_test):
...@@ -589,9 +587,7 @@ class TestNotificationToolWithCRM(TestNotificationTool): ...@@ -589,9 +587,7 @@ class TestNotificationToolWithCRM(TestNotificationTool):
Check that if notification format is html. Check that if notification format is html.
""" """
message = """\ message = """<a href="http://www.erp5.com/">Click Here!!</a>"""
<a href="http://www.erp5.com/">Click Here!!</a>
"""
self.portal.portal_notifications.sendMessage( self.portal.portal_notifications.sendMessage(
recipient='userA', subject='Subject', recipient='userA', subject='Subject',
...@@ -607,7 +603,7 @@ class TestNotificationToolWithCRM(TestNotificationTool): ...@@ -607,7 +603,7 @@ class TestNotificationToolWithCRM(TestNotificationTool):
# #
# With CRM, it support HTML mail. # With CRM, it support HTML mail.
# #
self.assertEquals(mail_dict['body'], message) self.assertEquals(mail_dict['body'], '<html><body>%s</body></html>' % message)
self.assertSameSet([], mail_dict['attachment_list']) self.assertSameSet([], mail_dict['attachment_list'])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment