summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2025-06-26 20:45:27 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2025-06-26 20:45:50 +0200
commitff154f1174a1272ee7fd07e6c7974c3fb0ef5fc7 (patch)
tree1e4c7c1958d8fa5f75fdbb8236b14990ddc5800b
parent737587eda4391494b1c44caa5e21ad7c2ff9ef50 (diff)
downloadIshtar-ff154f1174a1272ee7fd07e6c7974c3fb0ef5fc7.tar.bz2
Ishtar-ff154f1174a1272ee7fd07e6c7974c3fb0ef5fc7.zip
✅ fix tests
-rw-r--r--archaeological_context_records/tests.py1
-rw-r--r--archaeological_files/tests.py1
-rw-r--r--archaeological_finds/tests.py7
-rw-r--r--archaeological_operations/tests.py1
-rw-r--r--archaeological_warehouse/tests.py1
-rw-r--r--ishtar_common/tests.py18
6 files changed, 25 insertions, 4 deletions
diff --git a/archaeological_context_records/tests.py b/archaeological_context_records/tests.py
index da6bcfc30..dc810bcab 100644
--- a/archaeological_context_records/tests.py
+++ b/archaeological_context_records/tests.py
@@ -534,6 +534,7 @@ class ContextRecordTest(ContextRecordInit, TestCase):
cr = models.ContextRecord.objects.get(pk=cr.pk)
cr.test_obj = test_obj
cr.label = "New label!"
+ cr._no_down_model_update = False
cr.save()
# verify the relevance of the update
diff --git a/archaeological_files/tests.py b/archaeological_files/tests.py
index 47d0339e8..ee323591a 100644
--- a/archaeological_files/tests.py
+++ b/archaeological_files/tests.py
@@ -695,6 +695,7 @@ class FileOperationTest(TestCase, OperationInitTest, FileInit):
# no parcel on the file -> new parcels are copied from the
# operation
self.operation.associated_file = self.item
+ self.operation._no_down_model_update = False
self.operation.save()
self.assertEqual(self.item.parcels.count(), initial_nb + 10)
# parcel owner well attached
diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py
index e7b520fb6..e84d86836 100644
--- a/archaeological_finds/tests.py
+++ b/archaeological_finds/tests.py
@@ -282,7 +282,10 @@ class FindWizardCreationTest(WizardTest, FindInit, TestCase):
url_name = "find_creation"
wizard_name = "find_wizard"
steps = views.find_creation_steps
- redirect_url = "/find_modification/selec-find_modification?open_item=" "{last_id}"
+ redirect_url = [
+ "/find_modification/selec-find_modification?open_item={last_id}",
+ "/find_modification/selecw-find_modification?open_item={last_id}",
+ ]
model = models.Find
form_datas = [
FormData(
@@ -1136,6 +1139,7 @@ class FindTest(FindInit, TestCase):
cr = ContextRecord.objects.get(pk=base_find.context_record.pk)
cr.label = "new-label-too"
cr.skip_history_when_saving = True
+ cr._no_down_model_update = False
cr.save()
base_find = models.BaseFind.objects.get(pk=base_find.pk)
find = models.Find.objects.get(pk=find.pk)
@@ -1145,6 +1149,7 @@ class FindTest(FindInit, TestCase):
cr.operation.code_patriarche = "PAT"
cr.operation.skip_history_when_saving = True
+ cr.operation._no_down_model_update = False
cr.operation.save()
base_find = models.BaseFind.objects.get(pk=base_find.pk)
find = models.Find.objects.get(pk=find.pk)
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py
index b0b9c9dae..a6b90dd51 100644
--- a/archaeological_operations/tests.py
+++ b/archaeological_operations/tests.py
@@ -2326,6 +2326,7 @@ class OperationTest(TestCase, OperationInitTest):
operation = models.Operation.objects.get(pk=operation.pk)
operation.code_patriarche = "666"
+ operation._no_down_model_update = False # strange bug in full test condition
operation.save()
cr = ContextRecord.objects.get(pk=cr.pk)
self.assertIsNotNone(cr.cached_label)
diff --git a/archaeological_warehouse/tests.py b/archaeological_warehouse/tests.py
index 91773b77b..371d0d782 100644
--- a/archaeological_warehouse/tests.py
+++ b/archaeological_warehouse/tests.py
@@ -1004,6 +1004,7 @@ class ContainerTest(FindInit, TestCase):
warehouse = models.Warehouse.objects.get(pk=self.main_warehouse.pk)
warehouse.name = "New name"
warehouse.slug = "new-name"
+ warehouse._no_down_model_update = False
warehouse.save()
self.assertEqual(models.Container.objects.filter(need_update=True).count(), 1)
self.assertEqual(
diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py
index f9c928d5e..52913975b 100644
--- a/ishtar_common/tests.py
+++ b/ishtar_common/tests.py
@@ -604,7 +604,7 @@ class WizardTest(object):
if idx == len(self.steps) - 1:
# last form
if not self.redirect_url:
- redirect_url = "/{}/done".format(self.url_uri)
+ redirect_urls = ["/{}/done".format(self.url_uri)]
else:
dct = {"url_name": self.url_name, "url_uri": self.url_uri, "last_id": 0}
form_key = "selec-" + self.url_name
@@ -614,8 +614,20 @@ class WizardTest(object):
q = self.model.objects
if q.count():
dct["last_id"] = q.order_by("-pk").all()[0].pk
- redirect_url = self.redirect_url.format(**dct)
- self.assertRedirects(response, redirect_url)
+ if not isinstance(self.redirect_url, (list, tuple)):
+ redirect_urls = [self.redirect_url.format(**dct)]
+ else:
+ redirect_urls = [url.format(**dct) for url in self.redirect_url]
+ current_error, ok = None, False
+ for url in redirect_urls:
+ try:
+ self.assertRedirects(response, url)
+ ok = True
+ break
+ except AssertionError as err:
+ current_error = err
+ if not ok:
+ raise current_error
return response
def test_wizard(self):