Commit bbd4e66e 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

(cherry picked from commit b919e0b5)
parent 7a3d7948
...@@ -50,12 +50,14 @@ ...@@ -50,12 +50,14 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>"""\n <value> <string encoding="cdata"><![CDATA[
"""\n
Get the Message List from DummyMailHost.\n Get the Message List from DummyMailHost.\n
\n \n
This is used by functional tests to get all\n This is used by functional tests to get all\n
emails sent by the instance. This will prevent \n emails sent by the instance. This will prevent\n
the instance spam mailing lists during the \n the instance spam mailing lists during the\n
Functional Tests.\n Functional Tests.\n
"""\n """\n
if getattr(context.MailHost, "getMessageList", None) is None:\n if getattr(context.MailHost, "getMessageList", None) is None:\n
...@@ -66,11 +68,22 @@ for mail in message_list:\n ...@@ -66,11 +68,22 @@ for mail in message_list:\n
for part in mail:\n for part in mail:\n
print part\n print part\n
print "="*79\n print "="*79\n
print "" \n print ""\n
\n \n
print "Total messages: %s" %len(message_list)\n print "Total messages: %s" %len(message_list)\n
\n
# If messages "looks like html", zope will set content type to text/html,\n
# and the assertTextPresent from selenium will be applied after the emails\n
# are interpreted as html.\n
# For example, the email "Name <email@example.com>" would be interpreted as\n
# an html entity and we cannot use assertTextPresent on it.\n
# To prevent that, we force content type to text.\n
container.REQUEST.RESPONSE.setHeader(\'Content-Type\', \'text/plain;charset=utf-8\')\n
\n
return printed\n return printed\n
</string> </value>
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
......
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