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.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/archaeological_warehouse/tests.py b/archaeological_warehouse/tests.py
index ebea75217..a5610893a 100644
--- a/archaeological_warehouse/tests.py
+++ b/archaeological_warehouse/tests.py
@@ -639,6 +639,8 @@ class ContainerTest(FindInit, TestCase):
self.assertEqual(models.Container.objects.count(), self.container_number + 1)
def test_change_location(self):
+ find = self.create_finds()[0][0]
+ find = Find.objects.get(pk=find.pk)
container = models.Container.objects.create(
reference="Test",
responsible=self.main_warehouse,
@@ -646,7 +648,6 @@ class ContainerTest(FindInit, TestCase):
container_type=models.ContainerType.objects.all()[0],
)
container.save()
- container = models.Container.objects.get(pk=container.pk)
container_2 = models.Container.objects.create(
reference="Test2",
responsible=self.main_warehouse,
@@ -654,8 +655,16 @@ class ContainerTest(FindInit, TestCase):
container_type=models.ContainerType.objects.all()[0],
parent=container,
)
+ container = models.Container.objects.get(pk=container.pk)
self.assertIn(self.main_warehouse.name, container.cached_location)
+ find.container = container
+ find.container_ref = container_2
+ find.save()
+ find = Find.objects.get(pk=find.pk)
+ self.assertEqual(find.container_fisrt_full_location, container.generate_full_location())
+ self.assertEqual(find.container_ref_fisrt_full_location, container_2.generate_full_location())
+
models.ContainerLocalisation.objects.create(
container=container,
division=self.div_link,
@@ -679,6 +688,16 @@ class ContainerTest(FindInit, TestCase):
)
container_2 = models.Container.objects.get(pk=container_2.pk)
self.assertEqual(container_2.location, other_warehouse)
+ find = Find.objects.get(pk=find.pk)
+ self.assertEqual(find.container_fisrt_full_location, container.generate_full_location())
+ self.assertEqual(find.container_ref_fisrt_full_location, container_2.generate_full_location())
+
+ find.container = None
+ find.container_ref = None
+ find.save()
+ find = Find.objects.get(pk=find.pk)
+ self.assertEqual(find.container_fisrt_full_location, "")
+ self.assertEqual(find.container_ref_fisrt_full_location, "")
"""
def test_reassign_existing_division_on_warehouse_change(self):