From e974c7c5dcf57dca2120360bf082de14e3eef492 Mon Sep 17 00:00:00 2001 From: Cefin Date: Wed, 1 Dec 2021 17:11:33 +0000 Subject: rapid action on document add document with parent source with tests #5172 part four: test perfectionning --- ishtar_common/tests.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py index 418b8a24b..b14cc5ab3 100644 --- a/ishtar_common/tests.py +++ b/ishtar_common/tests.py @@ -3591,28 +3591,27 @@ class DocumentTest(TestCase): c.login(username=self.username, password=self.password) response = c.get(url) self.assertEqual(response.status_code, 200) - content = response.content.decode() self.assertIn( 'option value="{}" selected'.format(self.ope1.pk), - content + response.content.decode() ) - self.assertIn(doc.title, content) + self.assertIn(doc.title, response.content.decode()) posted = {"authors": [], "title": "A child document"} posted["operations"] = [str(self.ope1.pk)] posted["source"] = [doc.pk] response = c.post(url, posted) - new_child_document_pk = self.ope1.documents.order_by("-pk").all()[0].pk + new_child_document = self.ope1.documents.order_by("-pk").all()[0] self.assertEqual(nb_doc + 1, models.Document.objects.count()) self.assertRedirects( response, "/document/edit/?open_item={}".format( - new_child_document_pk + new_child_document.pk ), ) response = c.get("/show-document/{}/".format(doc.pk)) - self.assertIn(posted["title"], content) - self.assertIn(doc.title, content) + self.assertIn(new_child_document.title, response.content.decode()) + self.assertIn(doc.title, response.content.decode()) class JinjaFilterTest(TestCase): -- cgit v1.2.3