2009-06-08 23:16:51 +02:00
|
|
|
import unittest
|
|
|
|
|
2009-06-10 22:17:36 +02:00
|
|
|
from zope.interface import alsoProvides
|
|
|
|
|
2009-06-08 23:16:51 +02:00
|
|
|
from Products.PloneTestCase.ptc import PloneTestCase
|
2009-06-10 22:17:36 +02:00
|
|
|
|
2009-06-08 23:16:51 +02:00
|
|
|
from plone.app.discussion.tests.layer import DiscussionLayer
|
|
|
|
|
|
|
|
class WorkflowTest(PloneTestCase):
|
|
|
|
|
|
|
|
layer = DiscussionLayer
|
|
|
|
|
2009-06-10 22:17:36 +02:00
|
|
|
def afterSetUp(self):
|
|
|
|
self.portal.portal_types['Document'].allow_discussion = True
|
|
|
|
self.portal_discussion = self.portal.portal_discussion
|
|
|
|
|
|
|
|
self.folder.invokeFactory('Document', 'doc1')
|
|
|
|
|
|
|
|
self.setRoles(('Reviewer',))
|
|
|
|
#alsoProvides(self.portal.REQUEST, DiscussionLayer)
|
|
|
|
|
2009-06-08 23:16:51 +02:00
|
|
|
def test_permission(self):
|
|
|
|
self.setRoles(('Reviewer',))
|
|
|
|
self.failUnless(self.portal.portal_membership.checkPermission('Review comments', self.folder), self.folder)
|
|
|
|
self.setRoles(('Member',))
|
|
|
|
self.failIf(self.portal.portal_membership.checkPermission('Review comments', self.folder), self.folder)
|
|
|
|
|
|
|
|
def test_workflows_installed(self):
|
|
|
|
self.failUnless('comment_review_workflow' in self.portal.portal_workflow.objectIds())
|
|
|
|
self.assertEquals(('one_state_workflow',),
|
|
|
|
self.portal.portal_workflow.getChainForPortalType('Discussion Item'))
|
|
|
|
|
|
|
|
def test_suite():
|
|
|
|
return unittest.defaultTestLoader.loadTestsFromName(__name__)
|