Fixed execution create method

* Fixed passing 'params' and 'input' parameters to API

Change-Id: Ic28e4a727f2fc2f454c02ed03ff17a7da00eb0d1
This commit is contained in:
Nikolay Mahotkin
2014-09-11 13:03:31 +04:00
parent 51a55e1f34
commit 4485f72c4c
2 changed files with 12 additions and 11 deletions

View File

@@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import json
from mistralclient.api import base
@@ -28,9 +30,10 @@ class ExecutionManager(base.ResourceManager):
data = {'workflow_name': workflow_name}
if workflow_input:
data.update({'workflow_input': workflow_input})
data.update({'input': json.dumps(workflow_input)})
data.update(params)
if params:
data.update({'params': json.dumps(params)})
return self._create('/executions', data)

View File

@@ -24,14 +24,12 @@ EXEC = {
'id': "123",
'workflow_name': 'my_wf',
'state': 'RUNNING',
'workflow_input': """
{
"person": {
"first_name": "John",
"last_name": "Doe"
}
'input': {
"person": {
"first_name": "John",
"last_name": "Doe"
}
"""
}
}
@@ -44,11 +42,11 @@ class TestExecutionsV2(base.BaseClientV2Test):
mock = self.mock_http_post(content=EXEC)
body = {
'workflow_name': EXEC['workflow_name'],
'workflow_input': EXEC['workflow_input'],
'input': json.dumps(EXEC['input']),
}
ex = self.executions.create(EXEC['workflow_name'],
EXEC['workflow_input'])
EXEC['input'])
self.assertIsNotNone(ex)
self.assertEqual(executions.Execution(self.executions, EXEC).__dict__,