diff --git a/src/plone/restapi/tests/test_services_linkintegrity.py b/src/plone/restapi/tests/test_services_linkintegrity.py index ccbe0046a6..ca1910e6a7 100644 --- a/src/plone/restapi/tests/test_services_linkintegrity.py +++ b/src/plone/restapi/tests/test_services_linkintegrity.py @@ -65,15 +65,17 @@ def test_return_right_breaches_for_reference_field(self): response = self.api_session.get( "/@linkintegrity", params={"uids": [self.doc2.UID()]} ) + result = response.json() self.assertEqual(response.status_code, 200) - self.assertEqual(len(result), 1) self.assertEqual(result[0]["@id"], self.doc2.absolute_url()) + self.assertEqual(len(result), 1) breaches = result[0]["breaches"] + self.assertEqual(breaches[0]["sources"][0]["uid"], IUUID(self.doc1)) + self.assertEqual(breaches[0]["sources"][0]["@id"], self.doc1.absolute_url()) self.assertEqual(len(breaches), 1) - self.assertEqual(breaches[0]["uid"], IUUID(self.doc1)) - self.assertEqual(breaches[0]["@id"], self.doc1.absolute_url()) + self.assertEqual(len(breaches[0]["sources"]), 1) def test_do_not_return_breaches_if_check_is_disabled(self): registry = getUtility(IRegistry) @@ -134,13 +136,14 @@ def test_return_right_breaches_for_blocks(self): result = response.json() self.assertEqual(response.status_code, 200) - self.assertEqual(len(result), 1) self.assertEqual(result[0]["@id"], self.doc2.absolute_url()) + self.assertEqual(len(result), 1) breaches = result[0]["breaches"] + self.assertEqual(breaches[0]["sources"][0]["uid"], IUUID(doc_with_rel)) + self.assertEqual(breaches[0]["sources"][0]["@id"], doc_with_rel.absolute_url()) self.assertEqual(len(breaches), 1) - self.assertEqual(breaches[0]["uid"], IUUID(doc_with_rel)) - self.assertEqual(breaches[0]["@id"], doc_with_rel.absolute_url()) + self.assertEqual(len(breaches[0]["sources"]), 1) def test_return_breaches_for_contents_in_subfolders(self): # create a folder structure @@ -182,13 +185,14 @@ def test_return_breaches_for_contents_in_subfolders(self): result = response.json() self.assertEqual(response.status_code, 200) - self.assertEqual(len(result), 1) self.assertEqual(result[0]["@id"], self.doc2.absolute_url()) + self.assertEqual(len(result), 1) breaches = result[0]["breaches"] + self.assertEqual(breaches[0]["sources"][0]["uid"], IUUID(doc_in_folder)) + self.assertEqual(breaches[0]["sources"][0]["@id"], doc_in_folder.absolute_url()) self.assertEqual(len(breaches), 1) - self.assertEqual(breaches[0]["uid"], IUUID(doc_in_folder)) - self.assertEqual(breaches[0]["@id"], doc_in_folder.absolute_url()) + self.assertEqual(len(breaches[0]["sources"]), 1) def test_return_items_total_in_subfolders(self): # create a folder structure @@ -335,4 +339,5 @@ def test_tree_breaches_no_duplicates(self): [source["uid"] for source in breaches[1]["sources"]], [IUUID(source_a), IUUID(source_c)], ) - self.assertEqual(len(breaches), 3) + # target parent + target child + self.assertEqual(len(breaches), 2)