Пример #1
0
    def test_completed(self):
        task_route = 0
        task_name = 't1'
        task_flow_pointer_id = constants.TASK_STATE_ROUTE_FORMAT % (task_name, str(task_route))

        context = {'__current_task': None}
        self.assertRaises(exc.ExpressionEvaluationException, funcs.completed_, context)

        context = {
            '__current_task': {'id': task_name, 'route': task_route},
            '__state': {
                'tasks': {task_flow_pointer_id: 0},
                'sequence': [{'status': statuses.RUNNING}]
            }
        }

        self.assertFalse(funcs.completed_(context))

        context = {
            '__current_task': {'id': task_name, 'route': task_route},
            '__state': {
                'tasks': {task_flow_pointer_id: 0},
                'sequence': [{'status': statuses.SUCCEEDED}]
            }
        }

        self.assertTrue(funcs.completed_(context))
Пример #2
0
    def test_completed(self):
        task_route = 0
        task_name = "t1"
        task_flow_pointer_id = constants.TASK_STATE_ROUTE_FORMAT % (task_name, str(task_route))

        context = {"__current_task": None}
        self.assertRaises(exc.ExpressionEvaluationException, funcs.completed_, context)

        context = {
            "__current_task": {"id": task_name, "route": task_route},
            "__state": {
                "tasks": {task_flow_pointer_id: 0},
                "sequence": [{"status": statuses.RUNNING}],
            },
        }

        self.assertFalse(funcs.completed_(context))

        context = {
            "__current_task": {"id": task_name, "route": task_route},
            "__state": {
                "tasks": {task_flow_pointer_id: 0},
                "sequence": [{"status": statuses.SUCCEEDED}],
            },
        }

        self.assertTrue(funcs.completed_(context))
Пример #3
0
    def test_completed(self):
        context = {'__current_task': None}
        self.assertRaises(exc.ExpressionEvaluationException, funcs.completed_, context)

        context = {
            '__current_task': {'id': 't1'},
            '__flow': {'tasks': {'t1': 0}, 'sequence': [{'state': states.RUNNING}]}
        }

        self.assertFalse(funcs.completed_(context))

        context = {
            '__current_task': {'id': 't1'},
            '__flow': {'tasks': {'t1': 0}, 'sequence': [{'state': states.SUCCEEDED}]}
        }

        self.assertTrue(funcs.completed_(context))