summaryrefslogtreecommitdiff
path: root/archaeological_warehouse/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_warehouse/tests.py')
-rw-r--r--archaeological_warehouse/tests.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/archaeological_warehouse/tests.py b/archaeological_warehouse/tests.py
index 347382e75..4e6ca9dd9 100644
--- a/archaeological_warehouse/tests.py
+++ b/archaeological_warehouse/tests.py
@@ -1142,6 +1142,24 @@ class ContainerTest(FindInit, TestCase):
"|".join(sorted([mat0.code, mat1.code, mat2.code])),
)
+ def test_prevent_parent_infinite_loop(self):
+ ct = models.ContainerType.objects.all()[0]
+ container_1 = models.Container.objects.create(
+ reference="Test 1", location=self.main_warehouse, container_type=ct
+ )
+ container_2 = models.Container.objects.create(
+ reference="Test 2", location=self.main_warehouse, container_type=ct,
+ parent=container_1
+ )
+ container_3 = models.Container.objects.create(
+ reference="Test 2", location=self.main_warehouse, container_type=ct,
+ parent=container_2
+ )
+ container_1.parent = container_3
+ container_1.save()
+ self.assertIsNone(models.Container.objects.get(pk=container_1.pk).parent)
+
+
def test_calculated_weight(self):
self.create_finds()
self.create_finds()