Browse Source

[MIG] html_image_url_extractor: Migration to 11.0

pull/1508/head
tarteo 7 years ago
committed by Pedro M. Baeza
parent
commit
534412ff47
  1. 9
      html_image_url_extractor/README.rst
  2. 3
      html_image_url_extractor/__init__.py
  3. 8
      html_image_url_extractor/__manifest__.py
  4. 3
      html_image_url_extractor/models/__init__.py
  5. 3
      html_image_url_extractor/models/ir_fields_converter.py
  6. 3
      html_image_url_extractor/tests/__init__.py
  7. 23
      html_image_url_extractor/tests/test_extractor.py

9
html_image_url_extractor/README.rst

@ -1,5 +1,5 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: https://www.gnu.org/licenses/agpl
:alt: License: AGPL-3 :alt: License: AGPL-3
========================== ==========================
@ -38,7 +38,7 @@ QWeb example::
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot :alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/149/10.0
:target: https://runbot.odoo-community.org/runbot/149/11.0
Known issues / Roadmap Known issues / Roadmap
====================== ======================
@ -61,6 +61,9 @@ Contributors
* Jairo Llopis <yajo.sk8@gmail.com> * Jairo Llopis <yajo.sk8@gmail.com>
* Vicent Cubells <vicent.cubells@tecnativa.com> * Vicent Cubells <vicent.cubells@tecnativa.com>
* Dennis Sluijk <d.sluijk@onestein.nl>
Do not contact contributors directly about support or help with technical issues.
Maintainer Maintainer
---------- ----------

3
html_image_url_extractor/__init__.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import models from . import models

8
html_image_url_extractor/__manifest__.py

@ -1,14 +1,14 @@
# -*- coding: utf-8 -*-
# Copyright 2016-2017 Jairo Llopis <jairo.llopis@tecnativa.com> # Copyright 2016-2017 Jairo Llopis <jairo.llopis@tecnativa.com>
# Copyright 2016 Tecnativa - Vicent Cubells # Copyright 2016 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{ {
"name": "Image URLs from HTML field", "name": "Image URLs from HTML field",
"summary": "Extract images found in any HTML field", "summary": "Extract images found in any HTML field",
"version": "10.0.1.0.0",
"version": "11.0.1.0.0",
"category": "Tools", "category": "Tools",
"website": "https://www.tecnativa.com",
"website": "https://github.com/OCA/server-tools",
"author": "Tecnativa, " "author": "Tecnativa, "
"Onestein, "
"Odoo Community Association (OCA)", "Odoo Community Association (OCA)",
"license": "AGPL-3", "license": "AGPL-3",
"application": False, "application": False,

3
html_image_url_extractor/models/__init__.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import ir_fields_converter from . import ir_fields_converter

3
html_image_url_extractor/models/ir_fields_converter.py

@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2016-2017 Jairo Llopis <jairo.llopis@tecnativa.com> # Copyright 2016-2017 Jairo Llopis <jairo.llopis@tecnativa.com>
# Copyright 2016 Tecnativa - Vicent Cubells # Copyright 2016 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import re import re
import logging import logging

3
html_image_url_extractor/tests/__init__.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import test_extractor from . import test_extractor

23
html_image_url_extractor/tests/test_extractor.py

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