diff options
Diffstat (limited to 'archaeological_warehouse/tests.py')
-rw-r--r-- | archaeological_warehouse/tests.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/archaeological_warehouse/tests.py b/archaeological_warehouse/tests.py index a76c2763f..81b8b3df5 100644 --- a/archaeological_warehouse/tests.py +++ b/archaeological_warehouse/tests.py @@ -531,6 +531,12 @@ class ContainerTest(FindInit, TestCase): ) container.save() container = models.Container.objects.get(pk=container.pk) + container_2 = models.Container.objects.create( + reference="Test2", responsible=self.main_warehouse, + location=self.main_warehouse, + container_type=models.ContainerType.objects.all()[0], + parent=container + ) self.assertIn(self.main_warehouse.name, container.cached_location) models.ContainerLocalisation.objects.create( @@ -548,6 +554,8 @@ class ContainerTest(FindInit, TestCase): container.save() self.assertFalse(models.ContainerLocalisation.objects.filter( division__warehouse=self.main_warehouse).count()) + container_2 = models.Container.objects.get(pk=container_2.pk) + self.assertEqual(container_2.location, other_warehouse) def test_reassign_existing_division_on_warehouse_change(self): container = models.Container.objects.create( @@ -768,7 +776,7 @@ class ContainerTest(FindInit, TestCase): top_container_2 = models.Container.objects.create( reference="Topref 2", - location=self.main_warehouse, + location=self.alt_warehouse, container_type=ct) find1.container = top_container_2 find1.container_ref = top_container_2 @@ -785,13 +793,13 @@ class ContainerTest(FindInit, TestCase): middle_container_2 = models.Container.objects.create( reference="Middle ref", - location=self.main_warehouse, + location=self.alt_warehouse, parent=top_container_2, container_type=ct2) bottom_container_3 = models.Container.objects.create( reference="Bottom ref", - location=self.main_warehouse, + location=self.alt_warehouse, parent=middle_container_2, container_type=ct3) find3.container = bottom_container_3 @@ -810,16 +818,19 @@ class ContainerTest(FindInit, TestCase): self.assertEqual(q.count(), 1) top_ref = q.all()[0] self.assertEqual(top_ref.finds.count(), 2) + self.assertEqual(top_ref.location, self.main_warehouse) q = models.Container.objects.filter(reference="Middle ref") self.assertEqual(q.count(), 1) middle = q.all()[0] self.assertEqual(middle.parent, top_ref) + self.assertEqual(middle.location, self.main_warehouse) q = models.Container.objects.filter(reference="Bottom ref") self.assertEqual(q.count(), 1) bottom = q.all()[0] self.assertEqual(bottom.parent, middle) + self.assertEqual(bottom.location, self.main_warehouse) |