Logo Search packages:      
Sourcecode: zope-cmfplacefulworkflow version File versions  Download package

def CMFPlacefulWorkflow::tests::testCMFPlacefulWorkflow::TestPlacefulWorkflow::test_11_In_and_Below (   self  ) 

In and below

Definition at line 353 of file testCMFPlacefulWorkflow.py.

00353                                   :
        """In and below"""
        self.logout()
        self.loginAsPortalOwner()
        wft = self.portal.portal_workflow
        self.portal.portal_types['Large Plone Folder']._setPropValue('global_allow', True)
        self.portal.invokeFactory('Large Plone Folder', id='folder')
        self.portal.folder.invokeFactory('Document', id='document')
        self.portal.folder.invokeFactory('Large Plone Folder', id='folder2')
        self.portal.folder.folder2.invokeFactory('Document', id='document2')
        self.portal.folder.invokeFactory('Large Plone Folder', id='large_folder3')
        self.portal.folder.large_folder3.invokeFactory('Document', id='document3')

        # Create a policy
        pwt = self.portal_placeful_workflow
        pwt.manage_addWorkflowPolicy('foo_bar_policy',
                                     'default_workflow_policy (Simple Policy)')

        # And redefine the chain for Document
        gsp1 = pwt.getWorkflowPolicyById('foo_bar_policy')
        gsp1.setChainForPortalTypes(['Document'], ['plone_workflow'])
        gsp1.setChainForPortalTypes(['Folder'], ['plone_workflow'])
        gsp1.setChainForPortalTypes(['Large Plone Folder'], ['plone_workflow'])

        # Create a policy
        pwt = self.portal_placeful_workflow
        pwt.manage_addWorkflowPolicy('foo_bar_policy2',
                                     'default_workflow_policy (Simple Policy)')

        # And redefine the chain for Document
        gsp2 = pwt.getWorkflowPolicyById('foo_bar_policy2')
        gsp2.setChainForPortalTypes(['Document'], ['folder_workflow'])
        gsp2.setChainForPortalTypes(['Folder'], ['folder_workflow'])
        gsp2.setChainForPortalTypes(['Large Plone Folder'], ['folder_workflow'])

        # Add a config to the folder using the policy
        self.portal.folder.manage_addProduct['CMFPlacefulWorkflow'].manage_addWorkflowPolicyConfig()

        # Set the policy for the config
        pc = getattr(self.portal.folder, WorkflowPolicyConfig_id)

        # In folder 1, we want to have plone_workflow
        # We set PolicyIn to the first policy in folder 1
        pc.setPolicyIn('foo_bar_policy')

        # In folder 2, we want to have folder_workflow
        # We set PolicyBelow to the second policy in folder 2
        pc.setPolicyBelow('foo_bar_policy2')

        # A document in folder 2 should have folder_workflow
        chain = wft.getChainFor(self.portal.folder.folder2.document2)
        self.assertEqual(tuple(chain), ('folder_workflow',))

        # Folder 2 should have folder_workflow
        chain = wft.getChainFor(self.portal.folder.document)
        self.assertEqual(tuple(chain), ('folder_workflow',))

        # A document in folder 1 should have folder_workflow
        chain = wft.getChainFor(self.portal.folder.document)
        self.assertEqual(tuple(chain), ('folder_workflow',))

        # Folder 1 should have plone_workflow
        chain = wft.getChainFor(self.portal.folder)
        self.assertEqual(tuple(chain), ('plone_workflow',))

    def test_11_copy_paste(self):


Generated by  Doxygen 1.6.0   Back to index