From 99c1cf4746bbb4149f7447244b8f0c28309af3d1 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 26 Jun 2025 20:45:27 +0200 Subject: ✅ fix tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ishtar_common/tests.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'ishtar_common/tests.py') diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py index 977c1bc26..6152f7799 100644 --- a/ishtar_common/tests.py +++ b/ishtar_common/tests.py @@ -599,7 +599,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 @@ -609,8 +609,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): -- cgit v1.2.3