From 8d262c4b43cb8fc127ea992ba65e9be856236ca6 Mon Sep 17 00:00:00 2001 From: Andrea Cecchi Date: Mon, 2 Dec 2024 10:33:16 +0100 Subject: [PATCH] Linkintegrity on root (#124) * enable linkintegrity also on site root * add changelog * fix changelog --- CHANGES.rst | 3 +- src/redturtle/volto/configure.zcml | 4 +++ .../volto/tests/test_blocks_linkintegrity.py | 31 +++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 4c9e6e3..ddf587f 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -6,7 +6,8 @@ Changelog - Add patch for blocksRetriever. [eikichi18] - +- Enable blocks linkintegrity on Site Root too. + [cekk] 5.6.2 (2024-11-28) ------------------ diff --git a/src/redturtle/volto/configure.zcml b/src/redturtle/volto/configure.zcml index af4992c..515fec2 100644 --- a/src/redturtle/volto/configure.zcml +++ b/src/redturtle/volto/configure.zcml @@ -69,4 +69,8 @@ + + + + diff --git a/src/redturtle/volto/tests/test_blocks_linkintegrity.py b/src/redturtle/volto/tests/test_blocks_linkintegrity.py index 4e91bbd..e219c67 100644 --- a/src/redturtle/volto/tests/test_blocks_linkintegrity.py +++ b/src/redturtle/volto/tests/test_blocks_linkintegrity.py @@ -703,3 +703,34 @@ def test_count_down_countdown_text_link_integrity(self): self.assertEqual(len(reference["sources"]), 1) self.assertEqual(reference["sources"][0]["uid"], self.document.UID()) self.assertEqual(reference["target"]["uid"], self.ref.UID()) + + def test_linkintegrity_works_also_on_site_root(self): + self.assertEqual(self.get_references(), []) + self.portal.blocks = { + "xyz": { + "@type": "testo_riquadro_semplice", + "simple_card_content": [ + { + "type": "p", + "children": [ + { + "type": "link", + "data": { + "url": f"/resolveuid/{self.ref.UID()}", + }, + "children": [{"text": "foo"}], + }, + ], + } + ], + } + } + notify(ObjectModifiedEvent(self.portal)) + + references = self.get_references() + reference = references[0] + + self.assertEqual(len(references), 1) + self.assertEqual(len(reference["sources"]), 1) + self.assertEqual(reference["sources"][0]["uid"], self.portal.UID()) + self.assertEqual(reference["target"]["uid"], self.ref.UID())