def test_failed(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.failed_, context) context = { '__current_task': {'id': task_name, 'route': task_route}, '__state': { 'tasks': {task_flow_pointer_id: 0}, 'sequence': [{'status': statuses.RUNNING}] } } self.assertFalse(funcs.failed_(context)) context = { '__current_task': {'id': task_name, 'route': task_route}, '__state': { 'tasks': {task_flow_pointer_id: 0}, 'sequence': [{'status': statuses.FAILED}] } } self.assertTrue(funcs.failed_(context))
def test_failed(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.failed_, context) context = { "__current_task": {"id": task_name, "route": task_route}, "__state": { "tasks": {task_flow_pointer_id: 0}, "sequence": [{"status": statuses.RUNNING}], }, } self.assertFalse(funcs.failed_(context)) context = { "__current_task": {"id": task_name, "route": task_route}, "__state": { "tasks": {task_flow_pointer_id: 0}, "sequence": [{"status": statuses.FAILED}], }, } self.assertTrue(funcs.failed_(context))
def test_failed(self): context = {'__current_task': None} self.assertRaises(exc.ExpressionEvaluationException, funcs.failed_, context) context = { '__current_task': {'id': 't1'}, '__flow': {'tasks': {'t1': 0}, 'sequence': [{'state': states.RUNNING}]} } self.assertFalse(funcs.failed_(context)) context = { '__current_task': {'id': 't1'}, '__flow': {'tasks': {'t1': 0}, 'sequence': [{'state': states.FAILED}]} } self.assertTrue(funcs.failed_(context))