Ejemplo n.º 1
0
    def test_viewactivation_lifecycle(self):
        flow_task = self.init_node(flow.View(lambda _: None))

        act = activation.ViewActivation()
        act.initialize(flow_task, Test.TaskStub())

        # check assign/reassin flow
        act.assign(Test.UserStub())
        self.assertEqual(act.task.status, STATUS.ASSIGNED)

        act.reassign(Test.UserStub())
        self.assertEqual(act.task.status, STATUS.ASSIGNED)

        act.unassign()
        self.assertEqual(act.task.status, STATUS.NEW)

        # execute
        act.assign(Test.UserStub())
        act.prepare()
        act.done()

        # undo
        act.undo()
        self.assertEqual(act.task.status, STATUS.NEW)
        act.cancel()
        self.assertEqual(act.task.status, STATUS.CANCELED)
Ejemplo n.º 2
0
    def test_view_activation_lifecycle(self):
        flow_task_mock = mock.Mock(
            spec=flow.View(lambda *args, **kwargs: None))
        flow_task_mock._outgoing = mock.Mock(return_value=[])
        task_mock = mock.Mock(spec=Task())

        act = activation.ViewActivation()
        act.initialize(flow_task_mock, task_mock)
        act.prepare()
        act.done()

        act.task.prepare.assert_called_once_with()
        act.task.done.assert_called_once_with()
        flow_task_mock._outgoing.assert_any_call()
Ejemplo n.º 3
0
    def test_viewactivation_lifecycle(self):
        flow_task = self.init(flow.View(lambda _: None))

        act = activation.ViewActivation()
        act.initialize(flow_task, TaskStub())

        # assign
        act.assign(UserStub())
        act.reassign(UserStub())
        act.unassign()
        act.assign(UserStub())

        act.prepare()
        act.done()
        act.undo()
        act.cancel()