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

def CMFPlacefulWorkflow::tests::testCMFPlacefulWorkflow::TestPlacefulWorkflow::test_04_addWorkflowPolicyAndDuplicateConfiguration (   self )
Add a workflow policy and duplicate another one

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

Definition at line 148 of file testCMFPlacefulWorkflow.py.

                                                                 :
        """Add a workflow policy and duplicate another one

        Use a python script that can duplicate another policy or portal_workflow configuration
        """
        self.loginAsPortalOwner()
        pw_tool = self.portal_placeful_workflow
        wf_tool = self.portal.portal_workflow
        ptypes = self.portal.portal_types.objectIds()

        ## Part One: duplicate portal_workflow
        pw_tool.manage_addWorkflowPolicy(id='foo_bar_policy',
                                         duplicate_id='portal_workflow',
                                         )

        policy = pw_tool.getWorkflowPolicyById('foo_bar_policy')

        self.assertEqual(policy.getDefaultChain('XXX'), wf_tool._default_chain)
        for ptype in ptypes:
            chain = policy.getChainFor(ptype)
            if chain is None:
                # Default empty chain is None in a policy and () in portal_workflow
                chain = ()
            self.assertEqual(chain , wf_tool.getChainFor(ptype))


        ## Part Two: duplicate another policy
        policy.setDefaultChain(['plone_workflow', 'folder_workflow'])
        policy.setChainForPortalTypes(['Document','Folder', 'Large Plone Folder'], ['plone_workflow', 'folder_workflow'])
        pw_tool.manage_addWorkflowPolicy(id='foo_bar_policy2',
                                         duplicate_id='foo_bar_policy',
                                         )

        policy2 = pw_tool.getWorkflowPolicyById('foo_bar_policy2')

        self.assertEqual(policy.getDefaultChain('XXX'), ('plone_workflow', 'folder_workflow'))
        for ptype in ptypes:
            if ptype not in ('Document','Folder', 'Large Plone Folder'):
                self.assertEqual(policy2.getChainFor(ptype), policy.getChainFor(ptype))
            else:
                self.assertEqual(policy2.getChainFor(ptype), ('plone_workflow', 'folder_workflow'))

        self.logout()


Generated by  Doxygen 1.6.0   Back to index