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 | 55194aeec747fc07dcaf054877dd194fd1106039 (patch) | |
tree | cc2d30385aebb2a7b6d3aebf8dbaa26134617bf0 /archaeological_warehouse/tests.py | |
parent | 33bcdb096df9e56238f6e21ad0c1da7bcd8e87c9 (diff) | |
download | Ishtar-55194aeec747fc07dcaf054877dd194fd1106039.tar.bz2 Ishtar-55194aeec747fc07dcaf054877dd194fd1106039.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)) + |