diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2020-04-07 12:36:55 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-02-28 12:15:20 +0100 |
commit | ffedddae0c27f165e9d839edc5421e415b491330 (patch) | |
tree | cc2d30385aebb2a7b6d3aebf8dbaa26134617bf0 /archaeological_warehouse/tests.py | |
parent | 0f96790ca2866d205b262c96ddb1b155abb80ef6 (diff) | |
download | Ishtar-ffedddae0c27f165e9d839edc5421e415b491330.tar.bz2 Ishtar-ffedddae0c27f165e9d839edc5421e415b491330.zip |
New container management: change ext id
Diffstat (limited to 'archaeological_warehouse/tests.py')
-rw-r--r-- | archaeological_warehouse/tests.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/archaeological_warehouse/tests.py b/archaeological_warehouse/tests.py index 37c342ef7..a342dc1f9 100644 --- a/archaeological_warehouse/tests.py +++ b/archaeological_warehouse/tests.py @@ -683,3 +683,38 @@ class ContainerTest(FindInit, TestCase): container = models.Container.objects.get(pk=container.pk) self.assertEqual(container.x, 33) + def test_external_id(self): + ct = models.ContainerType.objects.all()[0] + container_1 = models.Container.objects.create( + reference="Test", responsible=self.main_warehouse, + location=self.main_warehouse, + container_type=ct + ) + container_2 = models.Container.objects.create( + reference="Test 2", responsible=self.main_warehouse, + parent=container_1, + location=self.main_warehouse, + container_type=ct + ) + container_3 = models.Container.objects.create( + reference="Test 3", responsible=self.main_warehouse, + parent=container_2, + location=self.main_warehouse, + container_type=ct + ) + self.assertEqual( + container_1.external_id, + "{}-{}-{}".format( + self.main_warehouse.external_id, ct.txt_idx, + container_1.reference)) + self.assertEqual( + container_2.external_id, + "{}-{}-{}".format( + container_1.external_id, ct.txt_idx, + container_2.reference)) + self.assertEqual( + container_3.external_id, + "{}-{}-{}".format( + container_2.external_id, ct.txt_idx, + container_3.reference)) + |