plone / Products.CMFPlone

The core of the Plone content management system
https://plone.org
GNU General Public License v2.0
243 stars 186 forks source link

Actually disable explicit acquisition in Plone 6 #3872

Open gotcha opened 9 months ago

gotcha commented 9 months ago

Fix for https://github.com/plone/Products.CMFPlone/issues/3871

This still needs tests in order to avoid regression again.

mister-roboto commented 9 months ago

@gotcha thanks for creating this Pull Request and helping to improve Plone!

TL;DR: Finish pushing changes, pass all other checks, then paste a comment:

@jenkins-plone-org please run jobs

To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically.

Happy hacking!

davisagli commented 5 months ago

Please do add a test. I was working with this setting recently to enable the check for a project, and I found the naming is quite confusing. The test can probably be something like this

    def setUp(self):
        self.app = self.layer["app"]
        self.portal = self.layer["portal"]
        self.portal_url = self.portal.absolute_url()
        setRoles(self.portal, TEST_USER_ID, ["Manager"])

        api.content.create(
            container=self.portal,
            type="Document",
            id="page",
        )

        transaction.commit()
        self.api_session = RelativeSession(self.portal_url)
        self.api_session.auth = (SITE_OWNER_NAME, SITE_OWNER_PASSWORD)

    def test_acquired_object_returns_200(self):
        response = self.api_session.get("/page/page")
        self.assertEqual(response.status_code, 200)