Browse Source

[FIX] Do not test the specific exception

pull/1155/head
tarteo 7 years ago
parent
commit
65adbd8c28
  1. 18
      html_image_url_extractor/tests/test_extractor.py

18
html_image_url_extractor/tests/test_extractor.py

@ -1,10 +1,8 @@
# Copyright 2016-2017 Jairo Llopis <jairo.llopis@tecnativa.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from lxml import etree
from odoo.tools import mute_logger
from odoo.tests.common import TransactionCase
from ..models import ir_fields_converter
class ExtractorCase(TransactionCase):
@ -44,24 +42,20 @@ class ExtractorCase(TransactionCase):
self.assertEqual("/path/%d" % n, url)
self.assertEqual(n, 0)
@mute_logger(ir_fields_converter.__name__)
@mute_logger("odoo.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(""):
self.assertTrue(False) # You should never get here
with self.assertRaises(etree.XMLSyntaxError):
with self.assertRaises(Exception):
list(self.imgs_from_html("", fail=True))
@mute_logger(ir_fields_converter.__name__)
@mute_logger("odoo.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):
self.assertTrue(False) # You should never get here
with self.assertRaises(TypeError):
with self.assertRaises(Exception):
list(self.imgs_from_html(False, fail=True))
@mute_logger(ir_fields_converter.__name__)
def test_bad_html(self):
"""Bad HTML handled correctly."""
for laps, text in self.imgs_from_html("<<bad>"):
self.assertTrue(False) # You should never get here
Loading…
Cancel
Save