summaryrefslogtreecommitdiff
path: root/archaeological_warehouse/tests.py
diff options
context:
space:
mode:
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
commitffedddae0c27f165e9d839edc5421e415b491330 (patch)
treecc2d30385aebb2a7b6d3aebf8dbaa26134617bf0 /archaeological_warehouse/tests.py
parent0f96790ca2866d205b262c96ddb1b155abb80ef6 (diff)
downloadIshtar-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.py35
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))
+