|
|
@ -4,6 +4,7 @@ |
|
|
|
|
|
|
|
from lxml import etree |
|
|
|
from openerp.tests.common import TransactionCase |
|
|
|
from openerp.tools import mute_logger |
|
|
|
|
|
|
|
|
|
|
|
class ExtractorCase(TransactionCase): |
|
|
@ -44,6 +45,8 @@ class ExtractorCase(TransactionCase): |
|
|
|
self.assertEqual("/path/%d" % n, url) |
|
|
|
self.assertEqual(n, 0) |
|
|
|
|
|
|
|
@mute_logger("openerp.addons.html_image_url_extractor.models" |
|
|
|
".ir_fields_converter") |
|
|
|
def test_empty_html(self): |
|
|
|
"""Empty HTML handled correctly.""" |
|
|
|
for laps, text in self.imgs_from_html(""): |
|
|
@ -52,6 +55,8 @@ class ExtractorCase(TransactionCase): |
|
|
|
with self.assertRaises(etree.XMLSyntaxError): |
|
|
|
list(self.imgs_from_html("", fail=True)) |
|
|
|
|
|
|
|
@mute_logger("openerp.addons.html_image_url_extractor.models" |
|
|
|
".ir_fields_converter") |
|
|
|
def test_false_html(self): |
|
|
|
"""``False`` HTML handled correctly.""" |
|
|
|
for laps, text in self.imgs_from_html(False): |
|
|
@ -60,6 +65,8 @@ class ExtractorCase(TransactionCase): |
|
|
|
with self.assertRaises(TypeError): |
|
|
|
list(self.imgs_from_html(False, fail=True)) |
|
|
|
|
|
|
|
@mute_logger("openerp.addons.html_image_url_extractor.models" |
|
|
|
".ir_fields_converter") |
|
|
|
def test_bad_html(self): |
|
|
|
"""Bad HTML handled correctly.""" |
|
|
|
for laps, text in self.imgs_from_html("<<bad>"): |
|
|
|