[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
This commit is contained in:
parent
9037ca4480
commit
207675a174
|
@ -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,
|
||||
|
|
|
@ -1,5 +1,25 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Business Applications
|
||||
# Copyright (c) 2012-TODAY OpenERP S.A. <http://openerp.com>
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import unittest
|
||||
from openerp.tools.html_sanitize import html_sanitize
|
||||
|
||||
|
@ -21,21 +41,29 @@ test12</font></div><div><font color="#1f1f1f" face="monospace" size="2"><br></fo
|
|||
<a href="javascript:alert('malicious code')">test link</a>
|
||||
"""
|
||||
|
||||
|
||||
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<p>yop</p>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()
|
||||
unittest.main()
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue