Fix failure of run_action CLI command
* Dump the 'param' argument before creating action-execution. * Add functional tests for action-execution's creation and deletion. Closes-Bug: #1490894 Change-Id: I93346ba54cc7b6d8cc2cb1e62d93c8a70a02d0dd
This commit is contained in:
@@ -33,7 +33,7 @@ class ActionExecutionManager(base.ResourceManager):
|
||||
data['input'] = json.dumps(input)
|
||||
|
||||
if params:
|
||||
data['params'] = params
|
||||
data['params'] = json.dumps(params)
|
||||
|
||||
resp = self.client.http_client.post(
|
||||
'/action_executions',
|
||||
|
||||
@@ -680,6 +680,34 @@ class ActionExecutionCLITests(base_v2.MistralClientTestBase):
|
||||
self.assertEqual(wf_name, self.direct_wf['Name'])
|
||||
self.assertEqual(status, 'SUCCESS')
|
||||
|
||||
def test_act_execution_create_delete(self):
|
||||
action_ex = self.mistral_admin(
|
||||
'run-action',
|
||||
params="std.echo '{0}' --save-result".format(
|
||||
'{"output": "Hello!"}')
|
||||
)
|
||||
action_ex_id = self.get_value_of_field(action_ex, 'ID')
|
||||
|
||||
self.assertTableStruct(action_ex, ['Field', 'Value'])
|
||||
|
||||
name = self.get_value_of_field(action_ex, 'Name')
|
||||
wf_name = self.get_value_of_field(action_ex, 'Workflow name')
|
||||
task_name = self.get_value_of_field(action_ex, 'Task name')
|
||||
|
||||
self.assertEqual('std.echo', name)
|
||||
self.assertEqual('None', wf_name)
|
||||
self.assertEqual('None', task_name)
|
||||
|
||||
action_exs = self.mistral_admin('action-execution-list')
|
||||
|
||||
self.assertIn(action_ex_id, [ex['ID'] for ex in action_exs])
|
||||
|
||||
self.mistral_admin('action-execution-delete', params=action_ex_id)
|
||||
|
||||
action_exs = self.mistral_admin('action-execution-list')
|
||||
|
||||
self.assertNotIn(action_ex_id, [ex['ID'] for ex in action_exs])
|
||||
|
||||
|
||||
class NegativeCLITests(base_v2.MistralClientTestBase):
|
||||
"""This class contains negative tests."""
|
||||
|
||||
Reference in New Issue
Block a user