Exemplo n.º 1
0
    def testExecute(self):
        e = WorkflowTransitionCondition()
        e.wf_transitions = ['publish', 'hide']

        ex = getMultiAdapter(
            (
                self.portal,
                e,
                ActionSucceededEvent(
                    self.folder,
                    'dummy_workflow',
                    'publish',
                    None,
                )
            ),
            IExecutable,
        )
        self.assertTrue(ex())

        ex = getMultiAdapter(
            (
                self.portal,
                e,
                ActionSucceededEvent(
                    self.folder,
                    'dummy_workflow',
                    'retract',
                    None,
                )
            ),
            IExecutable,
        )
        self.assertFalse(ex())

        ex = getMultiAdapter(
            (
                self.portal,
                e,
                ActionSucceededEvent(
                    self.folder,
                    'dummy_workflow',
                    'hide',
                    None,
                )
            ),
            IExecutable,
        )
        self.assertTrue(ex())
 def testInvokeEditView(self):
     element = getUtility(IRuleCondition,
                          name='plone.conditions.WorkflowTransition')
     e = WorkflowTransitionCondition()
     editview = getMultiAdapter((e, self.folder.REQUEST),
                                name=element.editview)
     self.failUnless(isinstance(editview, WorkflowTransitionEditForm))
    def activate(self):
        """
        1) make sure condition is enabled for transition
        2) enable at root and bubble to item below
        """
        c = WorkflowTransitionCondition()
        c.wf_transitions = [self.transition.id]
        self.rule.conditions = [c]
        self.rule.event = IActionSucceededEvent

        assignable = IRuleAssignmentManager(self.portal)
        path = '/'.join(self.portal.getPhysicalPath())
        assignable[self.rule.__name__] = RuleAssignment(self.rule.id,
            enabled=True, bubbles=True)
        assignments = get_assignments(self.rule)
        if not path in assignments:
            assignments.insert(path)
Exemplo n.º 4
0
    def activate(self):
        """
        1) make sure condition is enabled for transition
        2) enable at root and bubble to item below
        """
        c = WorkflowTransitionCondition()
        c.wf_transitions = [self.transition.id]
        self.rule.conditions = [c]
        self.rule.event = IActionSucceededEvent

        assignable = IRuleAssignmentManager(self.portal)
        path = '/'.join(self.portal.getPhysicalPath())
        assignable[self.rule.__name__] = RuleAssignment(self.rule.id,
                                                        enabled=True,
                                                        bubbles=True)
        assignments = get_assignments(self.rule)
        if not path in assignments:
            assignments.insert(path)
    def testExecute(self):
        e = WorkflowTransitionCondition()
        e.wf_transitions = ["publish", "hide"]

        ex = getMultiAdapter(
            (self.portal, e, ActionSucceededEvent(self.folder, "dummy_workflow", "publish", None)), IExecutable
        )
        self.assertTrue(ex())

        ex = getMultiAdapter(
            (self.portal, e, ActionSucceededEvent(self.folder, "dummy_workflow", "retract", None)), IExecutable
        )
        self.assertFalse(ex())

        ex = getMultiAdapter(
            (self.portal, e, ActionSucceededEvent(self.folder, "dummy_workflow", "hide", None)), IExecutable
        )
        self.assertTrue(ex())