From 742412a7d80e4cfc3c325cd7f23cea8a1c85e591 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Thu, 16 Sep 2010 15:12:59 +0000 Subject: [PATCH] Test publish bulk actions as well. svn path=/plone.app.discussion/trunk/; revision=39943 --- .../discussion/tests/test_moderation_view.py | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/plone/app/discussion/tests/test_moderation_view.py b/plone/app/discussion/tests/test_moderation_view.py index ea6ccf6..8982f7b 100644 --- a/plone/app/discussion/tests/test_moderation_view.py +++ b/plone/app/discussion/tests/test_moderation_view.py @@ -103,13 +103,10 @@ class ModerationBulkActionsViewTest(PloneTestCase): self.loginAsPortalOwner() typetool = self.portal.portal_types typetool.constructContent('Document', self.portal, 'doc1') + self.wf = getToolByName(self.portal, + 'portal_workflow', + None) - self.portal_discussion = getToolByName(self.portal, - 'portal_discussion', - None) - self.membership_tool = getToolByName(self.folder, - 'portal_membership') - self.memberdata = self.portal.portal_memberdata self.request = self.app.REQUEST self.context = self.portal self.portal.portal_workflow.setChainForPortalTypes( @@ -159,9 +156,20 @@ class ModerationBulkActionsViewTest(PloneTestCase): self.request = self.app.REQUEST self.context = self.portal self.request.set('form.select.BulkAction', 'publish') - self.request.set('paths', []) + self.request.set('paths', ['/'.join(self.comment1.getPhysicalPath())]) view = BulkActionsView(self.context, self.request) - + view() + + # Count published comments + published_comments = 0 + for r in self.conversation.getThreads(): + comment_obj = r['comment'] + workflow_status = self.wf.getInfoFor(comment_obj, 'review_state') + if workflow_status == 'published': + published_comments += 1 + + self.assertEquals(published_comments, 1) + def test_mark_as_spam(self): self.request = self.app.REQUEST self.context = self.portal