From fd381f2de8cd57302f21158e32ac83c1bd36816c Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Tue, 9 Aug 2022 12:56:13 +0200 Subject: [PATCH] edi_exchange_template_oca: add nswrapper test --- edi_exchange_template_oca/tests/__init__.py | 1 + .../tests/test_nswrapper.py | 58 +++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 edi_exchange_template_oca/tests/test_nswrapper.py 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))