From bbb1efbc1ce23cc18b57cea9755562023c889d34 Mon Sep 17 00:00:00 2001 From: Dmitri Zimine Date: Wed, 17 Sep 2014 21:23:04 -0700 Subject: [PATCH] Fix input on execution create This fix apparently broke it https://review.openstack.org/#/c/121510/4/mistral/api/controllers/v2/execution.py Added the dict to unit-tests. Tested with client: mistral execution-create wb1.wf1 '{ "str1":"foo", "str2":"bar" }' Change-Id: I75be2ab35210f1a7f1bdca1a18c1f7f375862d27 --- mistral/api/controllers/v2/execution.py | 3 +++ mistral/tests/unit/api/v2/test_executions.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/mistral/api/controllers/v2/execution.py b/mistral/api/controllers/v2/execution.py index 6f129e2d..bf7bf4c5 100644 --- a/mistral/api/controllers/v2/execution.py +++ b/mistral/api/controllers/v2/execution.py @@ -49,6 +49,9 @@ class Execution(resource.Resource): def to_dict(self): d = super(Execution, self).to_dict() + if d.get('input'): + d['input'] = json.loads(d['input']) + if d.get('output'): d['output'] = json.loads(d['output']) diff --git a/mistral/tests/unit/api/v2/test_executions.py b/mistral/tests/unit/api/v2/test_executions.py index f9bc273c..9908aac4 100644 --- a/mistral/tests/unit/api/v2/test_executions.py +++ b/mistral/tests/unit/api/v2/test_executions.py @@ -32,7 +32,7 @@ EXEC_DB = models.Execution( wf_name='some', wf_spec={'name': 'some'}, state=states.RUNNING, - input={}, + input={'foo': 'bar'}, output={}, created_at=datetime.datetime(1970, 1, 1), updated_at=datetime.datetime(1970, 1, 1) @@ -40,7 +40,7 @@ EXEC_DB = models.Execution( EXEC = { 'id': '123', - 'input': '{}', + 'input': '{"foo": "bar"}', 'output': '{}', 'state': 'RUNNING', 'created_at': '1970-01-01 00:00:00',