From db65535128fbaf1c04e822b17590ef5e082669df Mon Sep 17 00:00:00 2001 From: VoicuStefan2001 Date: Fri, 12 Jul 2024 13:05:21 +0300 Subject: [PATCH] [16.0][UPD] deltatech_data_sheet tests --- deltatech_data_sheet/tests/__init__.py | 1 + deltatech_data_sheet/tests/test_data_sheet.py | 36 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 deltatech_data_sheet/tests/__init__.py create mode 100644 deltatech_data_sheet/tests/test_data_sheet.py diff --git a/deltatech_data_sheet/tests/__init__.py b/deltatech_data_sheet/tests/__init__.py new file mode 100644 index 0000000000..a1bffa324b --- /dev/null +++ b/deltatech_data_sheet/tests/__init__.py @@ -0,0 +1 @@ +from . import test_data_sheet diff --git a/deltatech_data_sheet/tests/test_data_sheet.py b/deltatech_data_sheet/tests/test_data_sheet.py new file mode 100644 index 0000000000..bc7fda4a8a --- /dev/null +++ b/deltatech_data_sheet/tests/test_data_sheet.py @@ -0,0 +1,36 @@ +from odoo.tests.common import TransactionCase + + +class TestProductTemplate(TransactionCase): + def setUp(self): + super().setUp() + + # Create necessary records for the test + self.attachment_1 = self.env["ir.attachment"].create( + { + "name": "Test Data Sheet", + "mimetype": "application/pdf", + "public": True, + } + ) + + self.attachment_2 = self.env["ir.attachment"].create( + { + "name": "Test Safety Data Sheet", + "mimetype": "application/pdf", + "public": True, + } + ) + + self.product_template = self.env["product.template"].create( + { + "name": "Test Product", + "data_sheet_id": self.attachment_1.id, + "safety_data_sheet_id": self.attachment_2.id, + } + ) + + def test_product_template(self): + # Check that the product template was created with the correct data sheet and safety data sheet + self.assertEqual(self.product_template.data_sheet_id, self.attachment_1) + self.assertEqual(self.product_template.safety_data_sheet_id, self.attachment_2)