From 6f0fafd9492e1a0502c63f077707710d39f835a5 Mon Sep 17 00:00:00 2001 From: thien Date: Mon, 6 Nov 2023 16:34:19 +0700 Subject: [PATCH] [IMP] base_edifact: add unit test for export edifact --- base_edifact/tests/test_base_edifact.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/base_edifact/tests/test_base_edifact.py b/base_edifact/tests/test_base_edifact.py index 75bf12c309..6d6b02d96a 100644 --- a/base_edifact/tests/test_base_edifact.py +++ b/base_edifact/tests/test_base_edifact.py @@ -84,3 +84,20 @@ def test_map2odoo_description(self): seg = ["F", "79", ["", "", "", "Description"]] description = self.base_edifact_model.map2odoo_description(seg) self.assertEqual(description, "Description") + + def test_create_segment(self): + segment = self.base_edifact_model.create_segment("DTM", ["171", False, "102"]) + self.assertEqual(str(segment), "'DTM' EDI segment: [['171', '', '102']]") + + def test_create_interchange(self): + sender_edifact = ["40410", "14"] + recipient_edifact = ["40411", "14"] + control_ref = 10 + syntax_identifier = ["UNOC", "3"] + interchange = self.base_edifact_model.create_interchange( + sender_edifact, recipient_edifact, control_ref, syntax_identifier + ) + self.assertEqual(interchange.sender, ["40410", "14"]) + self.assertEqual(interchange.recipient, ["40411", "14"]) + self.assertEqual(interchange.control_reference, "10") + self.assertEqual(interchange.syntax_identifier, ["UNOC", "3"])