This commit is contained in:
Timo Stollenwerk 2013-04-17 14:24:39 +02:00
parent c678589df5
commit 628f72ea0b

View File

@ -47,9 +47,12 @@ class WorkflowSetupTest(unittest.TestCase):
def test_default_workflow(self): def test_default_workflow(self):
"""Make sure one_state_workflow is the default workflow. """Make sure one_state_workflow is the default workflow.
""" """
self.assertEqual(('one_state_workflow',), self.assertEqual(
self.portal.portal_workflow.getChainForPortalType( ('one_state_workflow',),
'Discussion Item')) self.portal.portal_workflow.getChainForPortalType(
'Discussion Item'
)
)
def test_review_comments_permission(self): def test_review_comments_permission(self):
#'Review comments' in self.portal.permissionsOfRole('Admin') #'Review comments' in self.portal.permissionsOfRole('Admin')
@ -58,8 +61,13 @@ class WorkflowSetupTest(unittest.TestCase):
self.assertTrue(self.portal.portal_membership.checkPermission( self.assertTrue(self.portal.portal_membership.checkPermission(
'Review comments', self.folder), self.folder) 'Review comments', self.folder), self.folder)
setRoles(self.portal, TEST_USER_ID, ['Member']) setRoles(self.portal, TEST_USER_ID, ['Member'])
self.assertFalse(self.portal.portal_membership.checkPermission( self.assertFalse(
'Review comments', self.folder), self.folder) self.portal.portal_membership.checkPermission(
'Review comments',
self.folder
),
self.folder
)
def test_reply_to_item_permission(self): def test_reply_to_item_permission(self):
pass pass
@ -121,8 +129,9 @@ class CommentOneStateWorkflowTest(unittest.TestCase):
comment.text = 'Comment text' comment.text = 'Comment text'
cid = conversation.addComment(comment) cid = conversation.addComment(comment)
self.comment = self.folder.doc1.restrictedTraverse(\ self.comment = self.folder.doc1.restrictedTraverse(
'++conversation++default/%s' % cid) '++conversation++default/%s' % cid
)
self.portal.acl_users._doAddUser('member', 'secret', ['Member'], []) self.portal.acl_users._doAddUser('member', 'secret', ['Member'], [])
self.portal.acl_users._doAddUser( self.portal.acl_users._doAddUser(
@ -228,25 +237,45 @@ class CommentReviewWorkflowTest(unittest.TestCase):
def test_publish(self): def test_publish(self):
self.portal.REQUEST.form['comment_id'] = self.comment_id self.portal.REQUEST.form['comment_id'] = self.comment_id
self.portal.REQUEST.form['workflow_action'] = 'publish' self.portal.REQUEST.form['workflow_action'] = 'publish'
self.assertEqual('pending', self.assertEqual(
self.portal.portal_workflow.getInfoFor( 'pending',
self.comment, 'review_state')) self.portal.portal_workflow.getInfoFor(
self.comment,
'review_state'
)
)
view = self.comment.restrictedTraverse('@@moderate-publish-comment') view = self.comment.restrictedTraverse('@@moderate-publish-comment')
view() view()
self.assertEqual('published', self.portal.portal_workflow.\ self.assertEqual(
getInfoFor(self.comment, 'review_state')) 'published',
self.portal.portal_workflow.getInfoFor(
self.comment,
'review_state'
)
)
def test_publish_as_anonymous(self): def test_publish_as_anonymous(self):
logout() logout()
self.portal.REQUEST.form['comment_id'] = self.comment_id self.portal.REQUEST.form['comment_id'] = self.comment_id
self.portal.REQUEST.form['workflow_action'] = 'publish' self.portal.REQUEST.form['workflow_action'] = 'publish'
self.assertEqual('pending', self.portal.portal_workflow.\ self.assertEqual(
getInfoFor(self.comment, 'review_state')) 'pending', self.portal.portal_workflow.getInfoFor(
self.assertRaises(Unauthorized, self.comment,
self.comment.restrictedTraverse, 'review_state'
'@@moderate-publish-comment') )
self.assertEqual('pending', self.portal.portal_workflow.\ )
getInfoFor(self.comment, 'review_state')) self.assertRaises(
Unauthorized,
self.comment.restrictedTraverse,
'@@moderate-publish-comment'
)
self.assertEqual(
'pending',
self.portal.portal_workflow.getInfoFor(
self.comment,
'review_state'
)
)
def test_suite(): def test_suite():