diff options
Diffstat (limited to 'archaeological_finds/tests.py')
| -rw-r--r-- | archaeological_finds/tests.py | 25 | 
1 files changed, 22 insertions, 3 deletions
diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py index 3c38583ae..5a7e53849 100644 --- a/archaeological_finds/tests.py +++ b/archaeological_finds/tests.py @@ -2202,6 +2202,12 @@ class FindQATest(FindInit, TestCase):              location=main_warehouse,              container_type=ContainerType.objects.all()[0],          ) +        container2_base = Container.objects.create( +            reference="Test2 base", +            responsible=main_warehouse, +            location=main_warehouse, +            container_type=ContainerType.objects.all()[0], +        )          packaging = models.TreatmentType.objects.get(txt_idx="packaging")          packaging.change_reference_location = True          packaging.change_current_location = False @@ -2285,7 +2291,7 @@ class FindQATest(FindInit, TestCase):              find_0.container, find_0.container_ref = None, None              find_0.skip_history_when_saving = True              find_0.save() -            find_1.container, find_1.container_ref = None, None +            find_1.container, find_1.container_ref = container2_base, container2_base              find_1.skip_history_when_saving = True              find_1.save() @@ -2294,10 +2300,23 @@ class FindQATest(FindInit, TestCase):              response = c.post(reverse("find-qa-packaging", args=[pks]), data)              self.assertRedirects(response, "/success/")              for k in check: +                value = check[k] +                value2 = check[k] +                if k == "container" and data["qa-packaging-container_to_change"] == "reference": +                    # if current not set -> auto set container to container_ref +                    value = check["container_ref"] +                    # current set for find_1 -> keep it +                    value2 = Container.objects.get(reference="Test2 base") +                if k == "container_ref" and data["qa-packaging-container_to_change"] == "current": +                    value = None +                    # ref set for find_1 -> keep it +                    value2 = Container.objects.get(reference="Test2 base")                  find = models.Find.objects.get(pk=find_0.pk) -                self.assertEqual(getattr(find, k), check[k]) +                self.assertEqual(getattr(find, k), value, +                                 f"find-qa-packaging: find_0 {k} not set for data {data}")                  find = models.Find.objects.get(pk=find_1.pk) -                self.assertEqual(getattr(find, k), check[k]) +                self.assertEqual(getattr(find, k), value2, +                                 f"find-qa-packaging: find_1 {k} not set for data {data}")              final_nb_treat = models.Treatment.objects.count()              self.assertEqual(init_nb_treat + nb_treat, final_nb_treat)  | 
