From 50ff75f6f20aff94f9a899eccb59b85fdf5bde0d Mon Sep 17 00:00:00 2001 From: rf-ife Date: Fri, 29 Nov 2024 19:13:32 +0100 Subject: [PATCH] [ADD] Test sequence prefix inheritance --- .../test_maintenance_equipment_sequence.py | 41 +++++++++++-------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/maintenance_equipment_sequence/tests/test_maintenance_equipment_sequence.py b/maintenance_equipment_sequence/tests/test_maintenance_equipment_sequence.py index 361a374c0..eb22b1f30 100644 --- a/maintenance_equipment_sequence/tests/test_maintenance_equipment_sequence.py +++ b/maintenance_equipment_sequence/tests/test_maintenance_equipment_sequence.py @@ -19,23 +19,6 @@ def test_01_maintenance_equipment_sequence(self): sequence number has been set """ # Create category - seq_0 = self.sequence_obj.create( - { - "name": "Test Sequence", - "implementation": "no_gap", - "prefix": "TTC_TEST", - "padding": 4, - "number_increment": 1, - "use_date_range": False, - } - ) - categ_0 = self.maintenance_equipment_categ_obj.create( - { - "name": "Test Category 0", - "sequence_id": seq_0.id, - } - ) - self.assertEqual(categ_0.sequence_prefix, seq_0.prefix) categ_1 = self.maintenance_equipment_categ_obj.create( { @@ -77,3 +60,27 @@ def test_01_maintenance_equipment_sequence(self): # Remove code and be automatically set to sequence next value equipment_1.write({"serial_no": False}) self.assertEqual(equipment_1.serial_no, "TTC0002") + + def test_02_maintenance_equipment_sequence(self): + """Create an equipment category linked to a default sequence with a prefix, + and verify that the category correctly inherits the sequence prefix. + """ + # Create a sequence + seq_1 = self.sequence_obj.create( + { + "name": "Test Sequence", + "implementation": "no_gap", + "prefix": "TTC_TEST", + "padding": 4, + "number_increment": 1, + "use_date_range": False, + } + ) + # Create an equipment category linked to the sequence + categ_1 = self.maintenance_equipment_categ_obj.create( + { + "name": "Test Category 0", + "sequence_id": seq_1.id, + } + ) + self.assertEqual(categ_1.sequence_prefix, seq_1.prefix)