[IMP] tools/mail: html_email_clean() roudtrips falsy values

bzr revid: fme@openerp.com-20121121081940-z4onugwqi7uxqvw3
This commit is contained in:
Fabien Meghazi 2012-11-21 09:19:40 +01:00
commit df5287b077
2 changed files with 6 additions and 0 deletions

View File

@ -173,6 +173,9 @@ class TestCleaner(unittest2.TestCase):
new_html = html_email_clean(TEXT_TPL)
self.assertNotIn('quote', new_html, 'html_email_cleaner did not remove correctly plaintext quotes')
# Test5: False boolean for text must return empty string
new_html = html_email_clean(False)
self.assertEqual(new_html, False, 'html_email_cleaner did change a False in an other value.')
class TestHtmlTools(unittest2.TestCase):
""" Test some of our generic utility functions about html """

View File

@ -130,6 +130,9 @@ def html_email_clean(html):
dest += source[idx:]
return dest
if not html:
return html
html = ustr(html)
# 1. <br[ /]> -> \n, because otherwise the tree is obfuscated