Skip to content

Commit

Permalink
Explicitly globally disable comments in the tests that need it. (#1805)
Browse files Browse the repository at this point in the history
In Plone 6.1, when you actively activate plone.app.discussion, we may globally enable comments by default.
This is when plone/plone.app.discussion#244 gets merged.

We already had eight or so tests that explicitly globally enable comments.
Now we explicitly globally disable them in two others.
Then the tests work in Plone 6.0 and 6.1.

See two test failures here for the plone.app.discussion PR:
https://jenkins.plone.org/job/pull-request-6.1-3.10/311/
  • Loading branch information
mauritsvanrees authored Sep 4, 2024
1 parent aec08ce commit 7b1f0f4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions news/244.tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Explicitly globally disable comments in the tests that need it.
[maurits]
6 changes: 6 additions & 0 deletions src/plone/restapi/tests/test_dxcontent_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,9 @@ def test_allow_discussion_by_default(self):
self.assertEqual(False, obj["allow_discussion"])

def test_allow_discussion_obj_instance_allows_but_not_global_enabled(self):
registry = queryUtility(IRegistry)
settings = registry.forInterface(IDiscussionSettings, check=False)
settings.globally_enabled = False
self.portal.invokeFactory("Document", id="doc2")
self.portal.doc2.allow_discussion = True
serializer = getMultiAdapter((self.portal.doc2, self.request), ISerializeToJson)
Expand All @@ -536,6 +539,9 @@ def test_allow_discussion_obj_instance_allows_but_not_global_enabled(self):
self.assertEqual(False, obj["allow_discussion"])

def test_allow_discussion_fti_allows_not_global_enabled(self):
registry = queryUtility(IRegistry)
settings = registry.forInterface(IDiscussionSettings, check=False)
settings.globally_enabled = False
self.portal.invokeFactory("Document", id="doc2")
portal_types = getToolByName(self.portal, "portal_types")
document_fti = getattr(portal_types, self.portal.doc2.portal_type)
Expand Down

0 comments on commit 7b1f0f4

Please sign in to comment.