Skip to content

Commit 2f3462e

Browse files
Explicitly globally disable comments in the tests that need it.
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/
1 parent 37d02e7 commit 2f3462e

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

news/244.tests

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Explicitly globally disable comments in the tests that need it.
2+
[maurits]

src/plone/restapi/tests/test_dxcontent_serializer.py

+6
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,9 @@ def test_allow_discussion_by_default(self):
527527
self.assertEqual(False, obj["allow_discussion"])
528528

529529
def test_allow_discussion_obj_instance_allows_but_not_global_enabled(self):
530+
registry = queryUtility(IRegistry)
531+
settings = registry.forInterface(IDiscussionSettings, check=False)
532+
settings.globally_enabled = False
530533
self.portal.invokeFactory("Document", id="doc2")
531534
self.portal.doc2.allow_discussion = True
532535
serializer = getMultiAdapter((self.portal.doc2, self.request), ISerializeToJson)
@@ -536,6 +539,9 @@ def test_allow_discussion_obj_instance_allows_but_not_global_enabled(self):
536539
self.assertEqual(False, obj["allow_discussion"])
537540

538541
def test_allow_discussion_fti_allows_not_global_enabled(self):
542+
registry = queryUtility(IRegistry)
543+
settings = registry.forInterface(IDiscussionSettings, check=False)
544+
settings.globally_enabled = False
539545
self.portal.invokeFactory("Document", id="doc2")
540546
portal_types = getToolByName(self.portal, "portal_types")
541547
document_fti = getattr(portal_types, self.portal.doc2.portal_type)

0 commit comments

Comments
 (0)