Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
plone.app.workflow.tests.test_simple_publication_workflow.TestSimplePublicationWorkflow Class Reference
Inheritance diagram for plone.app.workflow.tests.test_simple_publication_workflow.TestSimplePublicationWorkflow:
Inheritance graph
[legend]
Collaboration diagram for plone.app.workflow.tests.test_simple_publication_workflow.TestSimplePublicationWorkflow:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def testOwnerSubmitAPrivateDocumentAndRetract
def testOwnerCannotPublishDocument
def testViewIsNotAcquiredInPrivateState
def testViewPrivateDocument
def testViewIsNotAcquiredInPublishedState
def testViewPublishedDocument
def testAccessContentsInformationIsNotAcquiredInPrivateState
def testAccessContentsInformationPrivateDocument
def testAccessContentsInformationIsNotAcquiredInPublishedState
def testAccessContentsInformationPublishedDocument
def testModifyPrivateDocumentIsNotAcquiredInPrivateState
def testModifyPrivateDocument
def testModifyPortalContentIsNotAcquiredInPublishedState
def testModifyPublishedDocument
def testChangeEventsIsNotAcquiredInPrivateState
def testModifyPrivateEvent
def testChangeEventsIsNotAcquiredInPublishedState
def testModifyPublishEvent

Public Attributes

 catalog
 workflow
 doc
 ev

Detailed Description

Definition at line 19 of file test_simple_publication_workflow.py.


Member Function Documentation

Definition at line 21 of file test_simple_publication_workflow.py.

00021 
00022     def afterSetUp(self):
00023         self.catalog = self.portal.portal_catalog
00024         self.workflow = self.portal.portal_workflow
00025         self.workflow.setChainForPortalTypes(['Document','Event'], 'simple_publication_workflow')
00026 
00027         self.portal.acl_users._doAddUser('member', 'secret', ['Member'], [])
00028         self.portal.acl_users._doAddUser('reviewer', 'secret', ['Reviewer'], [])
00029         self.portal.acl_users._doAddUser('manager', 'secret', ['Manager'], [])
00030         self.portal.acl_users._doAddUser('editor' , ' secret', ['Editor'],[])
00031         self.portal.acl_users._doAddUser('reader', 'secret', ['Reader'], [])
00032 
00033         self.folder.invokeFactory('Document', id='doc')
00034         self.doc = self.folder.doc
00035         self.folder.invokeFactory('Event', id='ev')
00036         self.ev = self.folder.ev

Definition at line 109 of file test_simple_publication_workflow.py.

00109 
00110     def testAccessContentsInformationIsNotAcquiredInPrivateState(self):
00111         self.assertEqual(self.doc.acquiredRolesAreUsedBy(AccessContentsInformation), '')     # not checked

Definition at line 133 of file test_simple_publication_workflow.py.

00133 
00134     def testAccessContentsInformationIsNotAcquiredInPublishedState(self):
00135         # transition requires Review portal content
00136         self.login('manager')
00137         self.workflow.doActionFor(self.doc, 'publish')
00138         self.assertEqual(self.doc.acquiredRolesAreUsedBy(AccessContentsInformation), '') # not checked

Here is the call graph for this function:

Definition at line 112 of file test_simple_publication_workflow.py.

00112 
00113     def testAccessContentsInformationPrivateDocument(self):
00114         self.assertEqual(self.workflow.getInfoFor(self.doc, 'review_state'), 'private')
00115         # Owner is allowed
00116         self.login(default_user)
00117         self.failUnless(checkPerm(AccessContentsInformation, self.doc))
00118         # Member is denied
00119         self.login('member')
00120         self.failIf(checkPerm(AccessContentsInformation, self.doc))
00121         # Reviewer is denied
00122         self.login('reviewer')
00123         self.failIf(checkPerm(AccessContentsInformation, self.doc))
00124         # Anonymous is denied
00125         self.logout()
00126         self.failIf(checkPerm(AccessContentsInformation, self.doc))
00127         # Editor is allowed
00128         self.login('editor')
00129         self.failUnless(checkPerm(AccessContentsInformation, self.doc))
00130         # Reader is allowed
00131         self.login('reader')
00132         self.failUnless(checkPerm(AccessContentsInformation, self.doc))

Here is the call graph for this function:

Definition at line 139 of file test_simple_publication_workflow.py.

00139 
00140     def testAccessContentsInformationPublishedDocument(self):
00141         # transition requires Review portal content
00142         self.login('manager')
00143         self.workflow.doActionFor(self.doc, 'publish')
00144         # Owner is allowed
00145         self.login(default_user)
00146         self.failUnless(checkPerm(AccessContentsInformation, self.doc))
00147         # Member is allowed
00148         self.login('member')
00149         self.failUnless(checkPerm(AccessContentsInformation, self.doc))
00150         # Reviewer is denied but he acquires through Anonymous Role
00151         self.login('reviewer')
00152         self.failUnless(checkPerm(AccessContentsInformation, self.doc))
00153         # Anonymous is allowed
00154         self.logout()
00155         self.failUnless(checkPerm(AccessContentsInformation, self.doc))
00156         # Editor is allowed
00157         self.login('editor')
00158         self.failUnless(checkPerm(AccessContentsInformation, self.doc))
00159         # Reader is allowed
00160         self.login('reader')
00161         self.failUnless(checkPerm(AccessContentsInformation, self.doc))

Here is the call graph for this function:

Definition at line 221 of file test_simple_publication_workflow.py.

00221 
00222     def testChangeEventsIsNotAcquiredInPrivateState(self):
00223         self.assertEqual(self.workflow.getInfoFor(self.ev, 'review_state'), 'private')
00224         self.assertEqual(self.ev.acquiredRolesAreUsedBy(ChangeEvents), '')

Definition at line 246 of file test_simple_publication_workflow.py.

00246 
00247     def testChangeEventsIsNotAcquiredInPublishedState(self):
00248         # transition requires Review portal content
00249         self.login('manager')
00250         self.workflow.doActionFor(self.ev, 'publish')
00251         self.assertEqual(self.ev.acquiredRolesAreUsedBy(ChangeEvents), '')

Here is the call graph for this function:

Definition at line 188 of file test_simple_publication_workflow.py.

00188 
00189     def testModifyPortalContentIsNotAcquiredInPublishedState(self):
00190         # transition requires Review portal content
00191         self.login('manager')
00192         self.workflow.doActionFor(self.doc, 'publish')
00193         self.assertEqual(self.doc.acquiredRolesAreUsedBy(ModifyPortalContent), '')

Here is the call graph for this function:

Definition at line 167 of file test_simple_publication_workflow.py.

00167 
00168     def testModifyPrivateDocument(self):
00169         self.assertEqual(self.workflow.getInfoFor(self.doc, 'review_state'), 'private')
00170         # Owner is allowed
00171         self.login(default_user)
00172         self.failUnless(checkPerm(ModifyPortalContent, self.doc))
00173         # Member is denied
00174         self.login('member')
00175         self.failIf(checkPerm(ModifyPortalContent, self.doc))
00176         # Reviewer is denied
00177         self.login('reviewer')
00178         self.failIf(checkPerm(ModifyPortalContent, self.doc))
00179         # Anonymous is denied
00180         self.logout()
00181         self.failIf(checkPerm(ModifyPortalContent, self.doc))
00182         # Editor is allowed
00183         self.login('editor')
00184         self.failUnless(checkPerm(ModifyPortalContent, self.doc))
00185         # Reader is denied
00186         self.login('reader')
00187         self.failIf(checkPerm(ModifyPortalContent, self.doc))

Here is the call graph for this function:

Definition at line 164 of file test_simple_publication_workflow.py.

00164 
00165     def testModifyPrivateDocumentIsNotAcquiredInPrivateState(self):
00166         self.assertEqual(self.doc.acquiredRolesAreUsedBy(ModifyPortalContent), '') # not checked

Definition at line 225 of file test_simple_publication_workflow.py.

00225 
00226     def testModifyPrivateEvent(self):
00227         self.assertEqual(self.workflow.getInfoFor(self.ev, 'review_state'), 'private')
00228         # Owner is allowed
00229         self.login(default_user)
00230         self.failUnless(checkPerm(ChangeEvents, self.ev))
00231         # Member is denied
00232         self.login('member')
00233         self.failIf(checkPerm(ChangeEvents, self.ev))
00234         # Reviewer is denied
00235         self.login('reviewer')
00236         self.failIf(checkPerm(ChangeEvents, self.ev))
00237         # Anonymous is denied
00238         self.logout()
00239         self.failIf(checkPerm(ChangeEvents, self.ev))
00240         # Editor is allowed
00241         self.login('editor')
00242         self.failUnless(checkPerm(ChangeEvents, self.ev))
00243         # Reader is denied
00244         self.login('reader')
00245         self.failIf(checkPerm(ChangeEvents, self.ev))

Here is the call graph for this function:

Definition at line 194 of file test_simple_publication_workflow.py.

00194 
00195     def testModifyPublishedDocument(self):
00196         # transition requires Review portal content
00197         self.login('manager')
00198         self.workflow.doActionFor(self.doc, 'publish')
00199         # Manager is allowed
00200         self.failUnless(checkPerm(ModifyPortalContent, self.doc))
00201         # Owner is allowed
00202         self.login(default_user)
00203         self.failUnless(checkPerm(ModifyPortalContent, self.doc))
00204         # Member is denied
00205         self.login('member')
00206         self.failIf(checkPerm(ModifyPortalContent, self.doc))
00207         # Reviewer is denied
00208         self.login('reviewer')
00209         self.failIf(checkPerm(ModifyPortalContent, self.doc))
00210         # Anonymous is denied
00211         self.logout()
00212         self.failIf(checkPerm(ModifyPortalContent, self.doc))
00213         # Editor is allowed
00214         self.login('editor')
00215         self.failUnless(checkPerm(ModifyPortalContent, self.doc))
00216         # Reader is denied
00217         self.login('reader')
00218         self.failIf(checkPerm(ModifyPortalContent, self.doc))

Here is the call graph for this function:

Definition at line 252 of file test_simple_publication_workflow.py.

00252 
00253     def testModifyPublishEvent(self):
00254         # transition requires Review portal content
00255         self.login('manager')
00256         self.workflow.doActionFor(self.ev, 'publish')
00257         self.failUnless(checkPerm(ChangeEvents, self.ev))
00258         # Owner is allowed
00259         self.login(default_user)
00260         self.failUnless(checkPerm(ChangeEvents, self.ev))
00261         # Member is denied
00262         self.login('member')
00263         self.failIf(checkPerm(ChangeEvents, self.ev))
00264         # Reviewer is denied
00265         self.login('reviewer')
00266         self.failIf(checkPerm(ChangeEvents, self.ev))
00267         # Anonymous is denied
00268         self.logout()
00269         self.failIf(checkPerm(ChangeEvents, self.ev))
00270         # Editor is allowed
00271         self.login('editor')
00272         self.failUnless(checkPerm(ChangeEvents, self.ev))
00273         # Reader is denied
00274         self.login('reader')
00275         self.failIf(checkPerm(ChangeEvents, self.ev))
00276 

Here is the call graph for this function:

Definition at line 48 of file test_simple_publication_workflow.py.

00048 
00049     def testOwnerCannotPublishDocument(self):
00050         self.assertEqual(self.workflow.getInfoFor(self.doc, 'review_state'), 'private')
00051         self.assertRaises(WorkflowException, self.workflow.doActionFor, self.doc, 'publish')

Definition at line 39 of file test_simple_publication_workflow.py.

00039 
00040     def testOwnerSubmitAPrivateDocumentAndRetract(self):
00041         self.assertEqual(self.workflow.getInfoFor(self.doc, 'review_state'), 'private')
00042         self.workflow.doActionFor(self.doc, 'submit')
00043         self.assertEqual(self.workflow.getInfoFor(self.doc, 'review_state'), 'pending')
00044         self.workflow.doActionFor(self.doc, 'retract')
00045         self.assertEqual(self.workflow.getInfoFor(self.doc, 'review_state'), 'private')

Definition at line 54 of file test_simple_publication_workflow.py.

00054 
00055     def testViewIsNotAcquiredInPrivateState(self):
00056         self.assertEqual(self.doc.acquiredRolesAreUsedBy(View), '')     # not checked

Definition at line 78 of file test_simple_publication_workflow.py.

00078 
00079     def testViewIsNotAcquiredInPublishedState(self):
00080         # transition requires Review portal content
00081         self.login('manager')
00082         self.workflow.doActionFor(self.doc, 'publish')
00083         self.assertEqual(self.doc.acquiredRolesAreUsedBy(View), '')   # not checked

Here is the call graph for this function:

Definition at line 57 of file test_simple_publication_workflow.py.

00057 
00058     def testViewPrivateDocument(self):
00059         self.assertEqual(self.workflow.getInfoFor(self.doc, 'review_state'), 'private')
00060         # Owner is allowed
00061         self.login(default_user)
00062         self.failUnless(checkPerm(View, self.doc))
00063         # Member is denied
00064         self.login('member')
00065         self.failIf(checkPerm(View, self.doc))
00066         # Reviewer is denied
00067         self.login('reviewer')
00068         self.failIf(checkPerm(View, self.doc))
00069         # Anonymous is denied
00070         self.logout()
00071         self.failIf(checkPerm(View, self.doc))
00072         # Editor is allowed
00073         self.login('editor')
00074         self.failUnless(checkPerm(View, self.doc))
00075         # Reader is allowed
00076         self.login('reader')
00077         self.failUnless(checkPerm(View, self.doc))

Here is the call graph for this function:

Definition at line 84 of file test_simple_publication_workflow.py.

00084 
00085     def testViewPublishedDocument(self):
00086         # transition requires Review portal content
00087         self.login('manager')
00088         self.workflow.doActionFor(self.doc, 'publish')
00089         # Owner is allowed
00090         self.login(default_user)
00091         self.failUnless(checkPerm(View, self.doc))
00092         # Member is allowed
00093         self.login('member')
00094         self.failUnless(checkPerm(View, self.doc))
00095         # Reviewer is denied  but he acquires through Anonymous Role
00096         self.login('reviewer')
00097         self.failUnless(checkPerm(View, self.doc))
00098         # Anonymous is allowed
00099         self.logout()
00100         self.failUnless(checkPerm(View, self.doc))
00101         # Editor is allowed
00102         self.login('editor')
00103         self.failUnless(checkPerm(View, self.doc))
00104         # Reader is allowed
00105         self.login('reader')
00106         self.failUnless(checkPerm(View, self.doc))

Here is the call graph for this function:


Member Data Documentation

Definition at line 22 of file test_simple_publication_workflow.py.

Definition at line 33 of file test_simple_publication_workflow.py.

Definition at line 35 of file test_simple_publication_workflow.py.

Definition at line 23 of file test_simple_publication_workflow.py.


The documentation for this class was generated from the following file: