def test_action_manager_action_url(self):
        portal = self.layer["portal"]
        am = ActionManager()
        pw = getToolByName(portal, "portal_workflow")
        workflow = pw["simple_publication_workflow"]
        transition = workflow.transitions["publish"]
        rule = am.create(transition)

        element = getUtility(IRuleAction, name="plone.actions.Copy")
        adding = getMultiAdapter((rule.rule, self.layer["request"]), name="+action")
        addview = getMultiAdapter((adding, self.layer["request"]), name=element.addview)

        addview.createAndAdd(data={"target_folder": "/target"})

        ra = RuleAdapter(rule, transition)
        action = ra.get_action(0)
        self.assertTrue(rule.rule.id in ra.action_url(action) and "++0" in ra.action_url(action))
Пример #2
0
    def test_action_manager_action_index(self):
        portal = self.layer['portal']
        am = ActionManager()
        pw = getToolByName(portal, 'portal_workflow')
        workflow = pw['simple_publication_workflow']
        transition = workflow.transitions['publish']
        rule = am.create(transition)

        element = getUtility(IRuleAction, name='plone.actions.Copy')
        adding = getMultiAdapter((rule.rule, self.layer['request']),
                                 name='+action')
        addview = getMultiAdapter((adding, self.layer['request']),
                                  name=element.addview)

        addview.createAndAdd(data={'target_folder': '/target'})

        ra = RuleAdapter(rule, transition)
        action = ra.get_action(0)
        self.assertEquals(ra.action_index(action), 0)
    def test_action_manager_action_index(self):
        portal = self.layer['portal']
        am = ActionManager()
        pw = getToolByName(portal, 'portal_workflow')
        workflow = pw['simple_publication_workflow']
        transition = workflow.transitions['publish']
        rule = am.create(transition)

        element = getUtility(IRuleAction, name='plone.actions.Copy')
        adding = getMultiAdapter((rule.rule, self.layer['request']),
                                 name='+action')
        addview = getMultiAdapter((adding, self.layer['request']),
                                  name=element.addview)

        addview.createAndAdd(data={'target_folder': '/target'})

        ra = RuleAdapter(rule, transition)
        action = ra.get_action(0)
        self.assertEquals(ra.action_index(action), 0)
Пример #4
0
    def test_action_manager_action_url(self):
        portal = self.layer['portal']
        am = ActionManager()
        pw = getToolByName(portal, 'portal_workflow')
        workflow = pw['simple_publication_workflow']
        transition = workflow.transitions['publish']
        rule = am.create(transition)

        element = getUtility(IRuleAction, name='plone.actions.Copy')
        adding = getMultiAdapter((rule.rule, self.layer['request']),
                                 name='+action')
        addview = getMultiAdapter((adding, self.layer['request']),
                                  name=element.addview)

        try:
            createAndAdd = addview.form_instance.createAndAdd
        except AttributeError:
            createAndAdd = addview.createAndAdd
        createAndAdd(data={'target_folder': '/target'})

        ra = RuleAdapter(rule, transition)
        action = ra.get_action(0)
        self.assertTrue(rule.rule.id in ra.action_url(action) and \
                        '++0' in ra.action_url(action))