diff --git a/news/+rolemap_testfix.tests.md b/news/+rolemap_testfix.tests.md new file mode 100644 index 000000000..98cf44ad5 --- /dev/null +++ b/news/+rolemap_testfix.tests.md @@ -0,0 +1 @@ +Fixed test to allow Contributor and Editor to access inactive portal content. See https://github.com/plone/Products.CMFPlone/pull/4042. @petschki diff --git a/src/plone/restapi/tests/test_search.py b/src/plone/restapi/tests/test_search.py index 321755ef1..013c2e50e 100644 --- a/src/plone/restapi/tests/test_search.py +++ b/src/plone/restapi/tests/test_search.py @@ -660,27 +660,6 @@ def test_respect_access_inactive_permission(self): ).json() self.assertEqual(response["items_total"], 1) - # not admin users can't see expired items - self.api_session.auth = ("editoruser", TEST_USER_PASSWORD) - - response = self.api_session.get("/@search", params={}).json() - if HAS_PLONE_6: - # Since Plone 6 the Plone site is indexed ... - self.assertEqual(response["items_total"], 4) - else: - # ... before it was not - self.assertEqual(response["items_total"], 3) - response = self.api_session.get( - "/@search", params={"Title": "Lorem Ipsum"} - ).json() - self.assertEqual(response["items_total"], 0) - - # now grant permission to Editor to access inactive content - self.portal.manage_permission( - "Access inactive portal content", roles=["Manager", "Editor"] - ) - transaction.commit() - #  portal-enabled Editor can see expired contents response = self.api_session.get("/@search", params={}).json() if HAS_PLONE_6: @@ -718,6 +697,16 @@ def test_respect_access_inactive_permission(self): ).json() self.assertEqual(response["items_total"], 1) + # unauthorized users can not access expired content + self.api_session.auth = None + response = self.api_session.get("/@search", params={}).json() + if HAS_PLONE_6: + # Since Plone 6 the Plone site is indexed ... + self.assertEqual(response["items_total"], 1) + else: + # ... before it was not + self.assertEqual(response["items_total"], 0) + def test_search_use_site_search_settings_for_types(self): response = self.api_session.get( "/@search", params={"use_site_search_settings": 1}