diff --git a/edi_exchange_template_oca/tests/__init__.py b/edi_exchange_template_oca/tests/__init__.py index dbf4fc661..5a0606def 100644 --- a/edi_exchange_template_oca/tests/__init__.py +++ b/edi_exchange_template_oca/tests/__init__.py @@ -1 +1,2 @@ from . import test_edi_backend_output +from . import test_nswrapper diff --git a/edi_exchange_template_oca/tests/test_nswrapper.py b/edi_exchange_template_oca/tests/test_nswrapper.py new file mode 100644 index 000000000..4a5c87cea --- /dev/null +++ b/edi_exchange_template_oca/tests/test_nswrapper.py @@ -0,0 +1,58 @@ +# Copyright 2022 Camptocamp SA +# @author Simone Orsi +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). +from odoo.tests.common import SavepointCase +from odoo.tools import pycompat + +from ..utils import xml_purge_nswrapper + +ORDER_RESP_WRAPPER_TMPL = """ + + 2.2 +{} + +""" + +XML1 = """ + + + +""" + +XML2 = """ + + + 7302347231111 + + 7300070011115 + + + Moderna Produkter AB + + + +""" + + +class TestNSWrapper(SavepointCase): + maxDiff = None + + def test_purge1(self): + res = xml_purge_nswrapper(XML1) + self.assertNotIn("nswrapper", pycompat.to_text(res)) + + def test_purge2(self): + res = xml_purge_nswrapper(XML2) + self.assertNotIn("nswrapper", pycompat.to_text(res)) + + def test_purge3(self): + res = xml_purge_nswrapper(ORDER_RESP_WRAPPER_TMPL.format(XML2)) + self.assertNotIn("nswrapper", pycompat.to_text(res))