From 49fcaed8b0bffaba886c3ba699dcb3f8bfc1fb5c Mon Sep 17 00:00:00 2001 From: bosd Date: Wed, 1 Nov 2023 22:45:56 +0100 Subject: [PATCH] [IMP] base_business_document_import: test incoterm_match --- .../tests/test_business_document_import.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/base_business_document_import/tests/test_business_document_import.py b/base_business_document_import/tests/test_business_document_import.py index ffcbfaa565..ff2fc8c53f 100644 --- a/base_business_document_import/tests/test_business_document_import.py +++ b/base_business_document_import/tests/test_business_document_import.py @@ -9,7 +9,7 @@ from odoo.tests import tagged from odoo.tests.common import TransactionCase -_logger = logging.getLogger("odoo.tests.test_module_operations") +logger = logging.getLogger(__name__) @tagged("post_install", "-at_install") @@ -173,8 +173,8 @@ def test_match_product(self): try: bdio._match_product(product_dict, [], seller=False) raise_test = False - except Exception as e: - _logger.info(e) + except Exception: + logger.info("Exception catched.") self.assertTrue(raise_test) def test_match_uom(self): @@ -297,3 +297,15 @@ def test_match_account_smaller_in(self): res = bdio._match_account({"code": "898999"}, chatter) self.assertEqual(acc, res) self.assertEqual(len(chatter), 1) + + def test_incoterm_match(self): + bdoo = self.env["business.document.import"] + incoterm_dict = {"code": "EXW"} + res = bdoo._match_incoterm(incoterm_dict, []) + self.assertEquals(res, self.env.ref("account.incoterm_EXW")) + incoterm_dict = {"code": "EXW WORKS"} + res = bdoo._match_incoterm(incoterm_dict, []) + self.assertEquals(res, self.env.ref("account.incoterm_EXW")) + incoterm_dict = {} + res = bdoo._match_incoterm(incoterm_dict, []) + self.assertFalse(res)