Test publish bulk actions as well.

svn path=/plone.app.discussion/trunk/; revision=39943
This commit is contained in:
Timo Stollenwerk 2010-09-16 15:12:59 +00:00
parent 8d866a0ff6
commit 742412a7d8

View File

@ -103,13 +103,10 @@ class ModerationBulkActionsViewTest(PloneTestCase):
self.loginAsPortalOwner() self.loginAsPortalOwner()
typetool = self.portal.portal_types typetool = self.portal.portal_types
typetool.constructContent('Document', self.portal, 'doc1') typetool.constructContent('Document', self.portal, 'doc1')
self.wf = getToolByName(self.portal,
self.portal_discussion = getToolByName(self.portal, 'portal_workflow',
'portal_discussion',
None) None)
self.membership_tool = getToolByName(self.folder,
'portal_membership')
self.memberdata = self.portal.portal_memberdata
self.request = self.app.REQUEST self.request = self.app.REQUEST
self.context = self.portal self.context = self.portal
self.portal.portal_workflow.setChainForPortalTypes( self.portal.portal_workflow.setChainForPortalTypes(
@ -159,8 +156,19 @@ class ModerationBulkActionsViewTest(PloneTestCase):
self.request = self.app.REQUEST self.request = self.app.REQUEST
self.context = self.portal self.context = self.portal
self.request.set('form.select.BulkAction', 'publish') 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 = 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): def test_mark_as_spam(self):
self.request = self.app.REQUEST self.request = self.app.REQUEST