def test_result(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.result_, context) context = { '__current_task': {'id': task_name, 'route': task_route, 'result': 'foobar'}, '__state': { 'tasks': {task_flow_pointer_id: 0}, 'sequence': [{'status': statuses.SUCCEEDED}] } } self.assertEqual(funcs.result_(context), 'foobar') context = { '__current_task': {'id': task_name, 'route': task_route, 'result': {'fu': 'bar'}}, '__state': { 'tasks': {task_flow_pointer_id: 0}, 'sequence': [{'status': statuses.SUCCEEDED}] } } self.assertDictEqual(funcs.result_(context), {'fu': 'bar'})
def test_result(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.result_, context) context = { "__current_task": {"id": task_name, "route": task_route, "result": "foobar"}, "__state": { "tasks": {task_flow_pointer_id: 0}, "sequence": [{"status": statuses.SUCCEEDED}], }, } self.assertEqual(funcs.result_(context), "foobar") context = { "__current_task": {"id": task_name, "route": task_route, "result": {"fu": "bar"}}, "__state": { "tasks": {task_flow_pointer_id: 0}, "sequence": [{"status": statuses.SUCCEEDED}], }, } self.assertDictEqual(funcs.result_(context), {"fu": "bar"})
def test_result(self): context = {'__current_task': None} self.assertRaises(exc.ExpressionEvaluationException, funcs.result_, context) context = { '__current_task': {'id': 't1', 'result': 'foobar'}, '__flow': {'tasks': {'t1': 0}, 'sequence': [{'state': states.SUCCEEDED}]} } self.assertEqual(funcs.result_(context), 'foobar') context = { '__current_task': {'id': 't1', 'result': {'fu': 'bar'}}, '__flow': {'tasks': {'t1': 0}, 'sequence': [{'state': states.SUCCEEDED}]} } self.assertDictEqual(funcs.result_(context), {'fu': 'bar'})