From 207675a1743cdd60ba459d4e119af953096dbf87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 6 Nov 2012 12:54:20 +0100 Subject: [PATCH] [REN] html_sanitize -> mail, to have a central file for methods about mail (html sanitizing, html management, emails related functions, ...). bzr revid: tde@openerp.com-20121106115420-1h8mvzohol9zjysa --- openerp/tests/__init__.py | 4 +-- .../{test_html_sanitize.py => test_mail.py} | 36 ++++++++++++++++--- openerp/tools/__init__.py | 2 +- openerp/tools/{html_sanitize.py => mail.py} | 0 4 files changed, 35 insertions(+), 7 deletions(-) rename openerp/tests/{test_html_sanitize.py => test_mail.py} (67%) rename openerp/tools/{html_sanitize.py => mail.py} (100%) diff --git a/openerp/tests/__init__.py b/openerp/tests/__init__.py index c4b77a606a9..8f16fc76650 100644 --- a/openerp/tests/__init__.py +++ b/openerp/tests/__init__.py @@ -8,7 +8,7 @@ Tests can be explicitely added to the `fast_suite` or `checks` lists or not. See the :ref:`test-framework` section in the :ref:`features` list. """ -from . import test_expression, test_html_sanitize, test_ir_sequence, test_orm,\ +from . import test_expression, test_mail, test_ir_sequence, test_orm,\ test_fields, test_basecase, \ test_view_validation, test_uninstall, test_misc, test_db_cursor @@ -18,7 +18,7 @@ fast_suite = [ checks = [ test_expression, - test_html_sanitize, + test_mail, test_db_cursor, test_orm, test_fields, diff --git a/openerp/tests/test_html_sanitize.py b/openerp/tests/test_mail.py similarity index 67% rename from openerp/tests/test_html_sanitize.py rename to openerp/tests/test_mail.py index cb46b325144..14d49a3eefc 100755 --- a/openerp/tests/test_html_sanitize.py +++ b/openerp/tests/test_mail.py @@ -1,5 +1,25 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Business Applications +# Copyright (c) 2012-TODAY OpenERP S.A. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + import unittest from openerp.tools.html_sanitize import html_sanitize @@ -21,21 +41,29 @@ test12

test link """ + class TestSanitizer(unittest.TestCase): + # TDE note: could be improved by actually checking the output def test_simple(self): x = "yop" self.assertEqual(x, html_sanitize(x)) - + def test_trailing_text(self): x = 'lala

yop

xxx' self.assertEqual(x, html_sanitize(x)) - + def test_no_exception(self): html_sanitize(test_case) - + def test_unicode(self): html_sanitize("Merci à l'intérêt pour notre produit.nous vous contacterons bientôt. Merci") + +class TestCleaner(unittest.TestCase): + + def test(self): + print 'poinpoinpoinponi' + if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/openerp/tools/__init__.py b/openerp/tools/__init__.py index a0ca411a9df..af14189bbae 100644 --- a/openerp/tools/__init__.py +++ b/openerp/tools/__init__.py @@ -33,7 +33,7 @@ from pdf_utils import * from yaml_import import * from sql import * from float_utils import * -from html_sanitize import * +from mail import * #.apidoc title: Tools diff --git a/openerp/tools/html_sanitize.py b/openerp/tools/mail.py similarity index 100% rename from openerp/tools/html_sanitize.py rename to openerp/tools/mail.py