From 0d679fdaa3bb202eed7e77eb4112ac05f5e7c49b Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 22 Dec 2022 19:42:53 +0100 Subject: Fix tests --- ishtar_common/tests.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'ishtar_common/tests.py') diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py index f4e372770..d15675769 100644 --- a/ishtar_common/tests.py +++ b/ishtar_common/tests.py @@ -3918,10 +3918,16 @@ class DocumentTest(TestCase): c.login(username=self.username, password=self.password) response = c.get(url) self.assertEqual(response.status_code, 200) - self.assertIn( - 'option value="{}" selected'.format(self.ope1.pk), - response.content.decode() - ) + + result = response.content.decode() + soup = Soup(result, "lxml") + ok = False + for field in soup.findAll("option"): + keys = list(field.attrs.keys()) + if "selected" in keys and "value" in keys and field["value"] == str(self.ope1.pk): + ok = True + break + self.assertTrue(ok, msg="Operation not selected in Document form") self.assertIn(doc.title, response.content.decode()) posted = {"authors": [], "title": "A child document"} -- cgit v1.2.3