Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
CMFPlacefulWorkflow.tests.testCMFPlacefulWorkflow.TestPlacefulWorkflow Class Reference
Inheritance diagram for CMFPlacefulWorkflow.tests.testCMFPlacefulWorkflow.TestPlacefulWorkflow:
Inheritance graph
[legend]
Collaboration diagram for CMFPlacefulWorkflow.tests.testCMFPlacefulWorkflow.TestPlacefulWorkflow:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def createMember
def installation
def setupSecurityContext
def afterSetUp
def createArticle
def test_marker_applied_and_unapplied
def test_reinstall
def test_prefs_workflow_policy_mapping_set_PostOnly
def test_01_addWorkflowPolicyConfig
def test_02_checkWorkflowPolicyConfig
def test_03_addWorkflowPolicy
def test_04_addWorkflowPolicyAndConfigForIt
def test_04_addWorkflowPolicyAndDuplicateConfiguration
def test_05_editWorkflowPolicy
def test_06_getWorkflowPolicyIds
def test_07_getChainFor
def test_08_getChainFor
def test_09_wft_getChainFor
def test_10_wft_getChainFor_placeful
def test_11_In_and_Below
def test_11_copy_paste
def test_11_getWorkflowPolicyById_edge_cases
def test_12_getWorkflowPolicyById_edge_cases
def test_13_getWorkflowPolicyConfig
def test_14_getWorkflowPolicyConfig
def test_15_wft_getChainFor_placeful_with_strange_wrapper
def test_16_getWorklists

Public Attributes

 qi
 user1
 user2
 user3
 folder
 catalog
 workflow
 membershipTool
 memberdataTool
 portal_placeful_workflow
 contentId

Detailed Description

Testing all add-on and modified method for workflow stuff 

Definition at line 51 of file testCMFPlacefulWorkflow.py.


Member Function Documentation

afterSetUp(self) => This method is called to create an empty PloneArticle.
It also joins three users called 'user1', 'user2' and 'user3'.

Definition at line 76 of file testCMFPlacefulWorkflow.py.

00076 
00077     def afterSetUp(self,):
00078         """
00079         afterSetUp(self) => This method is called to create an empty PloneArticle.
00080         It also joins three users called 'user1', 'user2' and 'user3'.
00081         """
00082         #some usefull properties/tool
00083         self.catalog = getToolByName(self.portal, 'portal_catalog')
00084         self.workflow = getToolByName(self.portal, 'portal_workflow')
00085         self.membershipTool = getToolByName(self.portal, 'portal_membership')
00086         self.memberdataTool = getToolByName(self.portal, 'portal_memberdata')
00087 
00088         self.portal_placeful_workflow = getToolByName(self.portal, 'portal_placeful_workflow')
00089 
00090         self.setupSecurityContext()
00091 
00092         self.login('user1')
00093         #self.createPolicy()

Create new policy

Definition at line 94 of file testCMFPlacefulWorkflow.py.

00094 
00095     def createArticle(self, ):
00096         """
00097         Create new policy
00098         """
00099         # Content creation
00100         self.contentId = 'myPolicy'
00101 
00102         # XXX

def CMFPlacefulWorkflow.tests.testCMFPlacefulWorkflow.TestPlacefulWorkflow.createMember (   self,
  id,
  pw,
  email,
  roles = ('Member', 
)

Definition at line 54 of file testCMFPlacefulWorkflow.py.

00054 
00055     def createMember(self, id, pw, email, roles=('Member',)):
00056         pr = self.portal.portal_registration
00057         member = pr.addMember(id, pw, roles, properties={ 'username': id, 'email' : email })
00058         #self.failUnless(id in self.portal.Members.objectIds())
00059         return member

Definition at line 60 of file testCMFPlacefulWorkflow.py.

00060 
00061     def installation(self, productName):
00062         self.qi = self.portal.portal_quickinstaller
00063         self.qi.installProduct(productName)

Definition at line 64 of file testCMFPlacefulWorkflow.py.

00064 
00065     def setupSecurityContext(self,):
00066         self.logout()
00067         self.loginAsPortalOwner()
00068         # Create a few members
00069         self.user1 = self.createMember('user1', 'abcd4', 'abc@domain.tld')
00070         self.user2 = self.createMember('user2', 'abcd4', 'abc@domain.tld')
00071         self.user3 = self.createMember('user3', 'abcd4', 'abc@domain.tld')
00072 
00073         self.folder = self.portal.portal_membership.getHomeFolder('user1')
00074         self.installation('CMFPlacefulWorkflow')
00075         self.logout()

Here is the call graph for this function:

Add workflow policy config

Definition at line 139 of file testCMFPlacefulWorkflow.py.

00139 
00140     def test_01_addWorkflowPolicyConfig(self,):
00141         """
00142         Add workflow policy config
00143         """
00144         # No policy config should exist before
00145         self.failIf(WorkflowPolicyConfig_id in self.portal.objectIds() )
00146         # Add a policy config
00147         self.portal.manage_addProduct['CMFPlacefulWorkflow'].manage_addWorkflowPolicyConfig()
00148         # Make sure the policy config is there
00149         self.failUnless( WorkflowPolicyConfig_id in self.portal.objectIds() )

Here is the call graph for this function:

Add workflow policy config

Definition at line 150 of file testCMFPlacefulWorkflow.py.

00150 
00151     def test_02_checkWorkflowPolicyConfig(self,):
00152         """
00153         Add workflow policy config
00154         """
00155         self.portal.manage_addProduct['CMFPlacefulWorkflow'].manage_addWorkflowPolicyConfig()
00156         pc = getattr(self.portal, WorkflowPolicyConfig_id)
00157         self.failUnless(pc.getPolicyBelow()==None)
00158         self.failUnless(pc.getPolicyIn()==None)

Here is the call graph for this function:

Add workflow policy

Definition at line 159 of file testCMFPlacefulWorkflow.py.

00159 
00160     def test_03_addWorkflowPolicy(self,):
00161         """
00162         Add workflow policy
00163         """
00164         pwt = self.portal_placeful_workflow
00165         pwt.manage_addWorkflowPolicy('foo_bar_policy',
00166                                      'default_workflow_policy (Simple Policy)')
00167         gsp = getattr(pwt, 'foo_bar_policy', None)
00168         self.failUnless(gsp!=None)

Add workflow policy

Definition at line 169 of file testCMFPlacefulWorkflow.py.

00169 
00170     def test_04_addWorkflowPolicyAndConfigForIt(self,):
00171         """
00172         Add workflow policy
00173         """
00174         self.loginAsPortalOwner()
00175         pwt = self.portal_placeful_workflow
00176         pwt.manage_addWorkflowPolicy('foo_bar_policy',
00177                                      'default_workflow_policy (Simple Policy)')
00178         self.portal.manage_addProduct['CMFPlacefulWorkflow'].manage_addWorkflowPolicyConfig()
00179         pc = getattr(self.portal, WorkflowPolicyConfig_id)
00180         pc.setPolicyIn('foo_bar_policy')
00181         pc.setPolicyBelow('foo_bar_policy')
00182         self.failUnless(pc.getPolicyInId()=='foo_bar_policy')
00183         self.failUnless(pc.getPolicyBelowId()=='foo_bar_policy')
00184 
00185         self.logout()

Here is the call graph for this function:

Add a workflow policy and duplicate another one

Use a python script that can duplicate another policy or portal_workflow configuration

Definition at line 186 of file testCMFPlacefulWorkflow.py.

00186 
00187     def test_04_addWorkflowPolicyAndDuplicateConfiguration(self,):
00188         """Add a workflow policy and duplicate another one
00189 
00190         Use a python script that can duplicate another policy or portal_workflow configuration
00191         """
00192         self.loginAsPortalOwner()
00193         pw_tool = self.portal_placeful_workflow
00194         wf_tool = self.portal.portal_workflow
00195         ptypes = self.portal.portal_types.objectIds()
00196 
00197         ## Part One: duplicate portal_workflow
00198         pw_tool.manage_addWorkflowPolicy(id='foo_bar_policy',
00199                                          duplicate_id='portal_workflow',
00200                                          )
00201 
00202         policy = pw_tool.getWorkflowPolicyById('foo_bar_policy')
00203 
00204         self.assertEqual(policy.getDefaultChain('XXX'), wf_tool._default_chain)
00205         for ptype in ptypes:
00206             chain = policy.getChainFor(ptype)
00207             if chain is None:
00208                 # Default empty chain is None in a policy and () in portal_workflow
00209                 chain = ()
00210             self.assertEqual(chain , wf_tool.getChainFor(ptype))
00211 
00212 
00213         ## Part Two: duplicate another policy
00214         policy.setDefaultChain(['plone_workflow', 'folder_workflow'])
00215         policy.setChainForPortalTypes(['Document','Folder', 'Large Plone Folder'], ['plone_workflow', 'folder_workflow'])
00216         pw_tool.manage_addWorkflowPolicy(id='foo_bar_policy2',
00217                                          duplicate_id='foo_bar_policy',
00218                                          )
00219 
00220         policy2 = pw_tool.getWorkflowPolicyById('foo_bar_policy2')
00221 
00222         self.assertEqual(policy.getDefaultChain('XXX'), ('plone_workflow', 'folder_workflow'))
00223         for ptype in ptypes:
00224             if ptype not in ('Document','Folder', 'Large Plone Folder'):
00225                 self.assertEqual(policy2.getChainFor(ptype), policy.getChainFor(ptype))
00226             else:
00227                 self.assertEqual(policy2.getChainFor(ptype), ('plone_workflow', 'folder_workflow'))
00228 
00229         self.logout()

Here is the call graph for this function:

Edit workflow policy

Definition at line 230 of file testCMFPlacefulWorkflow.py.

00230 
00231     def test_05_editWorkflowPolicy(self,):
00232         """Edit workflow policy
00233         """
00234         pwt = self.portal_placeful_workflow
00235         pwt.manage_addWorkflowPolicy('foo_bar_policy',
00236                                      'default_workflow_policy (Simple Policy)')
00237         gsp = pwt.getWorkflowPolicyById('foo_bar_policy')
00238         gsp.setChainForPortalTypes(['Document','Folder'], ['plone_workflow','folder_workflow'])
00239         self.assertEqual(gsp.getChainFor('Document'), ('plone_workflow','folder_workflow',))
00240         self.assertEqual(gsp.getChainFor('Folder'), ('plone_workflow','folder_workflow',))

Definition at line 241 of file testCMFPlacefulWorkflow.py.

00241 
00242     def test_06_getWorkflowPolicyIds(self,):
00243         pwt = self.portal_placeful_workflow
00244         pwt.manage_addWorkflowPolicy('foo_bar_policy',
00245                                      'default_workflow_policy (Simple Policy)')
00246         pwt.manage_addWorkflowPolicy('foo_bar_policy_2',
00247                                      'default_workflow_policy (Simple Policy)')
00248         wp_ids=pwt.getWorkflowPolicyIds()
00249         self.failUnless('foo_bar_policy' in wp_ids)
00250         self.failUnless('foo_bar_policy_2' in wp_ids)
00251         # There are 4 base policies
00252         self.failUnless(len(wp_ids)==6)

Definition at line 253 of file testCMFPlacefulWorkflow.py.

00253 
00254     def test_07_getChainFor(self,):
00255         # Let's see what the chain is before
00256         self.logout()
00257         self.loginAsPortalOwner()
00258 
00259         pw = self.portal.portal_workflow
00260         self.failUnless(pw.getChainFor('Document')==('plone_workflow',) )
00261 
00262         self.portal.invokeFactory('Document', id='doc_before', text='foo bar baz')
00263 
00264         # The chain should be different now
00265         # Workflow tool should look for policy definition and return
00266         # the chain of the correct policy
00267         self.failUnless(pw.getChainFor(self.portal.doc_before)==('plone_workflow',) )
00268 
00269         # Let's define another policy
00270         pwt = self.portal_placeful_workflow
00271         pwt.manage_addWorkflowPolicy('foo_bar_policy',
00272                                      'default_workflow_policy (Simple Policy)')
00273 
00274         # And redefine the chain for Document
00275         gsp = pwt.getWorkflowPolicyById('foo_bar_policy')
00276 
00277         gsp.setChainForPortalTypes(['Document'], ['folder_workflow'])
00278 
00279         # Try getting the new chain directly
00280         self.assertEqual(gsp.getChainFor('Document'), ('folder_workflow',) )
00281 
00282         # Add a config at the root that will use the new policy
00283         self.portal.manage_addProduct['CMFPlacefulWorkflow'].manage_addWorkflowPolicyConfig()
00284         self.failUnless('.wf_policy_config' in self.portal.objectIds())
00285 
00286         # Let's set the policy to the config
00287         pc = getattr(self.portal, WorkflowPolicyConfig_id)
00288         pc.setPolicyIn('foo_bar_policy')
00289         pc.setPolicyBelow('foo_bar_policy')
00290 
00291         self.assertEqual(pc.getPlacefulChainFor('Document', start_here=1), ('folder_workflow',))
00292 
00293         self.portal.invokeFactory('Document', id='doc', text='foo bar baz')
00294 
00295         # The chain should be different now
00296         # Workflow tool should look for policy definition and return
00297         # the chain of the correct policy
00298         self.assertEqual(pw.getChainFor(self.portal.doc), ('folder_workflow',) )
00299         # The chain for the first document should have changed now
00300         self.assertEqual(pw.getChainFor(self.portal.doc_before), ('folder_workflow',) )

Here is the call graph for this function:

Definition at line 301 of file testCMFPlacefulWorkflow.py.

00301 
00302     def test_08_getChainFor(self,):
00303         # Let's see what the chain is before
00304         pwt = self.portal_placeful_workflow
00305         self.failUnless(pwt.getMaxChainLength()==1)
00306         pwt.setMaxChainLength(2)
00307         self.failUnless(pwt.getMaxChainLength()==2)

Definition at line 308 of file testCMFPlacefulWorkflow.py.

00308 
00309     def test_09_wft_getChainFor(self,):
00310         self.logout()
00311         self.loginAsPortalOwner()
00312         self.portal.invokeFactory('Folder', id='folder')
00313         self.portal.folder.invokeFactory('Document', id='document', text='foo')
00314 
00315         # Check default
00316         wft = self.portal.portal_workflow
00317         chain = wft.getChainFor('Document')
00318         self.assertEqual(tuple(chain), ('plone_workflow',))
00319 
00320         # Check global chain
00321         wft.setChainForPortalTypes(('Document',), ('wf',))
00322         chain = wft.getChainFor('Document')
00323         self.assertEqual(tuple(chain), ('wf',))
00324 
00325         # Check global chain, using object
00326         chain = wft.getChainFor(self.portal.folder.document)
00327         self.assertEqual(tuple(chain), ('wf',))
00328 
00329         # Remove global chain
00330         wft.setChainForPortalTypes(('Document',), ())
00331         chain = wft.getChainFor(self.portal.folder.document)
00332         self.assertEqual(tuple(chain), ())

Here is the call graph for this function:

Definition at line 333 of file testCMFPlacefulWorkflow.py.

00333 
00334     def test_10_wft_getChainFor_placeful(self):
00335         self.logout()
00336         self.loginAsPortalOwner()
00337         wft = self.portal.portal_workflow
00338         self.portal.invokeFactory('Folder', id='folder')
00339         self.portal.folder.invokeFactory('Document', id='document')
00340         self.portal.folder.invokeFactory('Folder', id='folder2')
00341         self.portal.folder.folder2.invokeFactory('Document', id='document2')
00342 
00343         # Create a policy
00344         pwt = self.portal_placeful_workflow
00345         pwt.manage_addWorkflowPolicy('foo_bar_policy',
00346                                      'default_workflow_policy (Simple Policy)')
00347 
00348         # And redefine the chain for Document
00349         gsp1 = pwt.getWorkflowPolicyById('foo_bar_policy')
00350         gsp1.setChainForPortalTypes(['Document'], ['folder_workflow'])
00351 
00352         # Add a config to the folder using the policy
00353         self.portal.folder.manage_addProduct['CMFPlacefulWorkflow'].manage_addWorkflowPolicyConfig()
00354 
00355         # Set the policy for the config
00356         pc = getattr(self.portal.folder, WorkflowPolicyConfig_id)
00357         pc.setPolicyIn('foo_bar_policy')
00358         pc.setPolicyBelow('foo_bar_policy')
00359 
00360         chain = wft.getChainFor(self.portal.folder.document)
00361         self.assertEqual(tuple(chain), ('folder_workflow',))
00362 
00363         # Create a different policy
00364         pwt = self.portal_placeful_workflow
00365         pwt.manage_addWorkflowPolicy('foo_bar_policy2',
00366                                      'default_workflow_policy (Simple Policy)')
00367 
00368         # And redefine the chain for Document
00369         gsp2 = pwt.getWorkflowPolicyById('foo_bar_policy2')
00370         gsp2.setChainForPortalTypes(['Document'], ['plone_workflow'])
00371 
00372         # Add a different config in the second folder
00373         self.portal.folder.folder2.manage_addProduct['CMFPlacefulWorkflow'].manage_addWorkflowPolicyConfig()
00374         pc = getattr(self.portal.folder.folder2, WorkflowPolicyConfig_id)
00375         pc.setPolicyIn('foo_bar_policy2')
00376         pc.setPolicyBelow('foo_bar_policy2')
00377 
00378         # Check inheritance order
00379         chain = wft.getChainFor(self.portal.folder.folder2.document2)
00380         self.assertEqual(tuple(chain), ('plone_workflow',))
00381 
00382         # Check empty chain
00383         gsp2.setChain('Document', ())
00384         chain = wft.getChainFor(self.portal.folder.folder2.document2)
00385         self.assertEqual(tuple(chain), ())
00386 
00387         # Check default
00388         wft.setDefaultChain('folder_workflow')
00389         gsp2.setChainForPortalTypes(('Document',), ('(Default)',))
00390         chain = wft.getChainFor(self.portal.folder.folder2.document2)
00391         self.assertEqual(tuple(chain), ('folder_workflow',))

Here is the call graph for this function:

Test security after a copy/paste

Definition at line 457 of file testCMFPlacefulWorkflow.py.

00457 
00458     def test_11_copy_paste(self):
00459         """ Test security after a copy/paste
00460         """
00461         self.logout()
00462         self.loginAsPortalOwner()
00463         wft = self.portal.portal_workflow
00464         self.portal.invokeFactory('Document', id='document')
00465         self.portal.invokeFactory('Folder', id='folder')
00466 
00467         # Create a policy
00468         pwt = self.portal_placeful_workflow
00469         pwt.manage_addWorkflowPolicy('foo_bar_policy',
00470                                      'default_workflow_policy (Simple Policy)')
00471 
00472         # And redefine the chain for Document
00473         gsp1 = pwt.getWorkflowPolicyById('foo_bar_policy')
00474         gsp1.setChainForPortalTypes(['Document'], ['folder_workflow'])
00475 
00476         # Add a config to the folder using the policy
00477         self.portal.folder.manage_addProduct['CMFPlacefulWorkflow'].manage_addWorkflowPolicyConfig()
00478 
00479         # Set the policy for the config
00480         pc = getattr(self.portal.folder, WorkflowPolicyConfig_id)
00481 
00482         # In folder, we want to have folder_workflow
00483         # We set PolicyIn to the first policy in folder
00484         pc.setPolicyIn('foo_bar_policy')
00485 
00486         cb = self.portal.manage_copyObjects(['document'])
00487         self.portal.folder.manage_pasteObjects(cb_copy_data=cb)
00488 
00489         # A document in plone root should have plone_workflow
00490         chain = wft.getChainFor(self.portal.document)
00491         self.assertEqual(tuple(chain), ('plone_workflow',))
00492 
00493         # Folder should have folder_workflow
00494         chain = wft.getChainFor(self.portal.folder)
00495         self.assertEqual(tuple(chain), ('folder_workflow',))
00496 
00497         # A document in folder should have folder_workflow
00498         chain = wft.getChainFor(self.portal.folder.document)
00499         self.assertEqual(tuple(chain), ('folder_workflow',))

Here is the call graph for this function:

Definition at line 500 of file testCMFPlacefulWorkflow.py.

00500 
00501     def test_11_getWorkflowPolicyById_edge_cases(self):
00502         pwt = self.portal_placeful_workflow
00503         self.assertEqual(pwt.getWorkflowPolicyById('dummy'), None)

In and below

Definition at line 392 of file testCMFPlacefulWorkflow.py.

00392 
00393     def test_11_In_and_Below(self):
00394         """In and below"""
00395         self.logout()
00396         self.loginAsPortalOwner()
00397         wft = self.portal.portal_workflow
00398         self.portal.portal_types['Large Plone Folder']._setPropValue('global_allow', True)
00399         self.portal.invokeFactory('Large Plone Folder', id='folder')
00400         self.portal.folder.invokeFactory('Document', id='document')
00401         self.portal.folder.invokeFactory('Large Plone Folder', id='folder2')
00402         self.portal.folder.folder2.invokeFactory('Document', id='document2')
00403         self.portal.folder.invokeFactory('Large Plone Folder', id='large_folder3')
00404         self.portal.folder.large_folder3.invokeFactory('Document', id='document3')
00405 
00406         # Create a policy
00407         pwt = self.portal_placeful_workflow
00408         pwt.manage_addWorkflowPolicy('foo_bar_policy',
00409                                      'default_workflow_policy (Simple Policy)')
00410 
00411         # And redefine the chain for Document
00412         gsp1 = pwt.getWorkflowPolicyById('foo_bar_policy')
00413         gsp1.setChainForPortalTypes(['Document'], ['plone_workflow'])
00414         gsp1.setChainForPortalTypes(['Folder'], ['plone_workflow'])
00415         gsp1.setChainForPortalTypes(['Large Plone Folder'], ['plone_workflow'])
00416 
00417         # Create a policy
00418         pwt = self.portal_placeful_workflow
00419         pwt.manage_addWorkflowPolicy('foo_bar_policy2',
00420                                      'default_workflow_policy (Simple Policy)')
00421 
00422         # And redefine the chain for Document
00423         gsp2 = pwt.getWorkflowPolicyById('foo_bar_policy2')
00424         gsp2.setChainForPortalTypes(['Document'], ['folder_workflow'])
00425         gsp2.setChainForPortalTypes(['Folder'], ['folder_workflow'])
00426         gsp2.setChainForPortalTypes(['Large Plone Folder'], ['folder_workflow'])
00427 
00428         # Add a config to the folder using the policy
00429         self.portal.folder.manage_addProduct['CMFPlacefulWorkflow'].manage_addWorkflowPolicyConfig()
00430 
00431         # Set the policy for the config
00432         pc = getattr(self.portal.folder, WorkflowPolicyConfig_id)
00433 
00434         # In folder 1, we want to have plone_workflow
00435         # We set PolicyIn to the first policy in folder 1
00436         pc.setPolicyIn('foo_bar_policy')
00437 
00438         # In folder 2, we want to have folder_workflow
00439         # We set PolicyBelow to the second policy in folder 2
00440         pc.setPolicyBelow('foo_bar_policy2')
00441 
00442         # A document in folder 2 should have folder_workflow
00443         chain = wft.getChainFor(self.portal.folder.folder2.document2)
00444         self.assertEqual(tuple(chain), ('folder_workflow',))
00445 
00446         # Folder 2 should have folder_workflow
00447         chain = wft.getChainFor(self.portal.folder.document)
00448         self.assertEqual(tuple(chain), ('folder_workflow',))
00449 
00450         # A document in folder 1 should have folder_workflow
00451         chain = wft.getChainFor(self.portal.folder.document)
00452         self.assertEqual(tuple(chain), ('folder_workflow',))
00453 
00454         # Folder 1 should have plone_workflow
00455         chain = wft.getChainFor(self.portal.folder)
00456         self.assertEqual(tuple(chain), ('plone_workflow',))

Here is the call graph for this function:

Definition at line 504 of file testCMFPlacefulWorkflow.py.

00504 
00505     def test_12_getWorkflowPolicyById_edge_cases(self):
00506         pwt = self.portal_placeful_workflow
00507         self.assertEqual(pwt.getWorkflowPolicyById(None), None)
00508 

Definition at line 509 of file testCMFPlacefulWorkflow.py.

00509 
00510     def test_13_getWorkflowPolicyConfig(self):
00511         pwt = self.portal_placeful_workflow
00512         config = pwt.getWorkflowPolicyConfig(self.portal)
00513         self.assertEqual(config, None)

Here is the call graph for this function:

Definition at line 514 of file testCMFPlacefulWorkflow.py.

00514 
00515     def test_14_getWorkflowPolicyConfig(self):
00516         self.logout()
00517         self.loginAsPortalOwner()
00518         wft = self.portal.portal_workflow
00519         self.portal.invokeFactory('Folder', id='folder')
00520         self.portal.folder.invokeFactory('Document', id='document')
00521         self.portal.folder.invokeFactory('Folder', id='folder2')
00522         self.portal.folder.folder2.invokeFactory('Document', id='document2')
00523 
00524         # Create a policy
00525         pwt = self.portal_placeful_workflow
00526         pwt.manage_addWorkflowPolicy('foo_bar_policy',
00527                                      'default_workflow_policy (Simple Policy)')
00528         # And redefine the chain for Document
00529         gsp1 = pwt.getWorkflowPolicyById('foo_bar_policy')
00530         gsp1.setChainForPortalTypes(['Document'], ['folder_workflow'])
00531 
00532         # Add a config to the folder using the policy
00533         self.portal.folder.manage_addProduct['CMFPlacefulWorkflow'].manage_addWorkflowPolicyConfig()
00534 
00535         # Set the policy for the config
00536         pc = getattr(self.portal.folder, WorkflowPolicyConfig_id)
00537         pc.setPolicyIn('foo_bar_policy')
00538         pc.setPolicyBelow('foo_bar_policy')
00539 
00540         # You should only be able to get a config in the folder itself
00541         config = pwt.getWorkflowPolicyConfig(self.portal.folder)
00542         self.failUnless(config!=None)
00543 
00544         # Not in the folder above
00545         config = pwt.getWorkflowPolicyConfig(self.portal)
00546         self.assertEqual(config, None)
00547 
00548         # Not in a document in the folder
00549         config = pwt.getWorkflowPolicyConfig(self.portal.folder.document)
00550         self.assertEqual(config, None)
00551 
00552         # Not in a folder below
00553         config = pwt.getWorkflowPolicyConfig(self.portal.folder.folder2)
00554         self.assertEqual(config, None)
00555 
00556         # Not in a document in a folder below
00557         config = pwt.getWorkflowPolicyConfig(self.portal.folder.folder2.document2)
00558         self.assertEqual(config, None)

Here is the call graph for this function:

Definition at line 559 of file testCMFPlacefulWorkflow.py.

00559 
00560     def test_15_wft_getChainFor_placeful_with_strange_wrapper(self):
00561         self.logout()
00562         self.loginAsPortalOwner()
00563         wft = self.portal.portal_workflow
00564         self.portal.invokeFactory('Folder', id='folder')
00565         self.portal.folder.invokeFactory('Document', id='document')
00566         self.portal.invokeFactory('Folder', id='folder2')
00567         self.portal.folder2.invokeFactory('Document', id='document2')
00568 
00569         # Create a policy
00570         pwt = self.portal_placeful_workflow
00571         pwt.manage_addWorkflowPolicy('foo_bar_policy',
00572                                      'default_workflow_policy (Simple Policy)')
00573 
00574         # And redefine the chain for Document
00575         gsp1 = pwt.getWorkflowPolicyById('foo_bar_policy')
00576         gsp1.setChainForPortalTypes(['Document'], ['folder_workflow'])
00577 
00578         # Add a config to the folder using the policy
00579         self.portal.folder.manage_addProduct['CMFPlacefulWorkflow'].manage_addWorkflowPolicyConfig()
00580 
00581         # Set the policy for the config
00582         pc = getattr(self.portal.folder, WorkflowPolicyConfig_id)
00583         pc.setPolicyIn('foo_bar_policy')
00584         pc.setPolicyBelow('foo_bar_policy')
00585 
00586         chain = wft.getChainFor(self.portal.folder2.document2)
00587         self.assertEqual(tuple(chain), ('plone_workflow',))
00588 
00589         # What if we acquired the doc from the wrong place
00590         wrapped_doc = self.portal.folder2.document2.__of__(self.portal.folder)
00591         chain = wft.getChainFor(wrapped_doc)
00592         self.assertEqual(tuple(chain), ('plone_workflow',))
00593 
00594         # What if we acquired the container from the wrong place
00595         wrapped_doc = self.portal.folder2.__of__(self.portal.folder).document2
00596         chain = wft.getChainFor(wrapped_doc)
00597         self.assertEqual(tuple(chain), ('plone_workflow',))

Here is the call graph for this function:

Verify if worklists are always accessible with a policy

Definition at line 598 of file testCMFPlacefulWorkflow.py.

00598 
00599     def test_16_getWorklists(self):
00600         """Verify if worklists are always accessible with a policy
00601         """
00602         wf_tool = self.portal.portal_workflow
00603         placeful_tool = self.portal_placeful_workflow
00604 
00605         self.loginAsPortalOwner()
00606 
00607         self.portal.invokeFactory('Folder', id='folder')
00608         self.portal.folder.invokeFactory('Document', id='document')
00609 
00610         # Create a policy
00611         placeful_tool.manage_addWorkflowPolicy('foo_bar_policy',
00612                                                'default_workflow_policy (Simple Policy)',
00613                                                'portal_workflow',)
00614         # And redefine the chain for Document in portal_workflow
00615         wf_tool.setChainForPortalTypes(['Document'], ())
00616 
00617         # Add a config to the folder using the policy
00618         self.portal.folder.manage_addProduct['CMFPlacefulWorkflow'].manage_addWorkflowPolicyConfig()
00619 
00620         # Set the policy for the config
00621         config = getattr(self.portal.folder, WorkflowPolicyConfig_id)
00622         config.setPolicyBelow('foo_bar_policy')
00623 
00624         # we make the document pending
00625         document = self.portal.folder.document
00626         wf_tool.doActionFor(document, 'submit', comment="unittest transition")
00627 
00628         self.assertEqual(
00629             sorted(tuple(wf_tool.getWorklists().keys())),
00630             sorted(('folder_workflow', 'plone_workflow',
00631                     'intranet_folder_workflow', 'one_state_workflow',
00632                     'simple_publication_workflow',
00633                     'intranet_workflow')))
00634         self.assertEqual(tuple(self.portal.my_worklist()), (document,))
00635 
00636         self.logout()
00637 

Here is the call graph for this function:

Check that the IPlacefulMarker is applied to the workflow tool by
the install, and removed by the uninstall.

Definition at line 103 of file testCMFPlacefulWorkflow.py.

00103 
00104     def test_marker_applied_and_unapplied(self):
00105         """
00106         Check that the IPlacefulMarker is applied to the workflow tool by
00107         the install, and removed by the uninstall.
00108         """
00109         self.failUnless(IPlacefulMarker.providedBy(self.workflow))
00110         self.loginAsPortalOwner()
00111         self.qi.uninstallProducts(['CMFPlacefulWorkflow'])
00112         self.failIf(IPlacefulMarker.providedBy(self.workflow))
00113         self.qi.installProduct('CMFPlacefulWorkflow')
00114         self.failUnless(IPlacefulMarker.providedBy(self.workflow))

Here is the call graph for this function:

Check POST on mapping policy

Definition at line 122 of file testCMFPlacefulWorkflow.py.

00122 
00123     def test_prefs_workflow_policy_mapping_set_PostOnly(self):
00124         """
00125         Check POST on mapping policy
00126         """
00127         self.loginAsPortalOwner()
00128         # add a policy to edit
00129         pwt = self.portal_placeful_workflow
00130         pwt.manage_addWorkflowPolicy('foo_bar_policy',
00131                                      'default_workflow_policy (Simple Policy)')
00132         # use a GET request which should fail
00133         self.app.REQUEST.set('REQUEST_METHOD', 'GET')
00134         self.assertRaises(Forbidden,
00135                           self.portal.prefs_workflow_policy_mapping_set,
00136                           True, 'foo_bar_policy', 'title', 'description',
00137                           {'Document': 'plone_workflow'}, 'plone_workflow')
00138 

Here is the call graph for this function:

Test if upgrade is going the good way

Definition at line 115 of file testCMFPlacefulWorkflow.py.

00115 
00116     def test_reinstall(self):
00117         """
00118         Test if upgrade is going the good way
00119         """
00120         self.qi = self.portal.portal_quickinstaller
00121         self.qi.installProduct('CMFPlacefulWorkflow', reinstall=True)


Member Data Documentation

Definition at line 82 of file testCMFPlacefulWorkflow.py.

Definition at line 99 of file testCMFPlacefulWorkflow.py.

Definition at line 72 of file testCMFPlacefulWorkflow.py.

Definition at line 85 of file testCMFPlacefulWorkflow.py.

Definition at line 84 of file testCMFPlacefulWorkflow.py.

Definition at line 87 of file testCMFPlacefulWorkflow.py.

Definition at line 61 of file testCMFPlacefulWorkflow.py.

Definition at line 68 of file testCMFPlacefulWorkflow.py.

Definition at line 69 of file testCMFPlacefulWorkflow.py.

Definition at line 70 of file testCMFPlacefulWorkflow.py.

Definition at line 83 of file testCMFPlacefulWorkflow.py.


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