Commit b919e0b5 authored by Jérome Perrin's avatar Jérome Perrin

ui_test_core: force content type as text/plain in MailHost_reportMessageList

Otherwise this is interpreted as text/html after sending html emails
parent 737a1971
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
Get the Message List from DummyMailHost. Get the Message List from DummyMailHost.
This is used by functional tests to get all This is used by functional tests to get all
emails sent by the instance. This will prevent emails sent by the instance. This will prevent
the instance spam mailing lists during the the instance spam mailing lists during the
Functional Tests. Functional Tests.
""" """
if getattr(context.MailHost, "getMessageList", None) is None: if getattr(context.MailHost, "getMessageList", None) is None:
...@@ -14,7 +14,16 @@ for mail in message_list: ...@@ -14,7 +14,16 @@ for mail in message_list:
for part in mail: for part in mail:
print part print part
print "="*79 print "="*79
print "" print ""
print "Total messages: %s" %len(message_list) print "Total messages: %s" %len(message_list)
# If messages "looks like html", zope will set content type to text/html,
# and the assertTextPresent from selenium will be applied after the emails
# are interpreted as html.
# For example, the email "Name <email@example.com>" would be interpreted as
# an html entity and we cannot use assertTextPresent on it.
# To prevent that, we force content type to text.
container.REQUEST.RESPONSE.setHeader('Content-Type', 'text/plain;charset=utf-8')
return printed return printed
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