Fix execution update description error
Fix the wrong param of db update execution api, add some tests accordingly. Change-Id: I7c389e781f9982703115d82d0336ddb0df6b2b99 Closes-Bug: #1467114
This commit is contained in:
parent
029b1f2ddf
commit
834f69839a
@ -153,7 +153,7 @@ class ExecutionsController(rest.RestController):
|
|||||||
if new_description:
|
if new_description:
|
||||||
wf_ex = db_api.update_workflow_execution(
|
wf_ex = db_api.update_workflow_execution(
|
||||||
id,
|
id,
|
||||||
description=new_description
|
{"description": new_description}
|
||||||
)
|
)
|
||||||
|
|
||||||
elif new_state == states.PAUSED:
|
elif new_state == states.PAUSED:
|
||||||
|
@ -321,6 +321,15 @@ class ExecutionTestsV2(base.TestCase):
|
|||||||
self.assertEqual(200, resp.status)
|
self.assertEqual(200, resp.status)
|
||||||
self.assertEqual('PAUSED', body['state'])
|
self.assertEqual('PAUSED', body['state'])
|
||||||
|
|
||||||
|
@test.attr(type='sanity')
|
||||||
|
def test_update_execution_description(self):
|
||||||
|
_, execution = self.client.create_execution(self.direct_wf)
|
||||||
|
resp, body = self.client.update_execution(
|
||||||
|
execution['id'], '{"description": "description"}')
|
||||||
|
|
||||||
|
self.assertEqual(200, resp.status)
|
||||||
|
self.assertEqual('description', body['description'])
|
||||||
|
|
||||||
@test.attr(type='sanity')
|
@test.attr(type='sanity')
|
||||||
def test_update_execution_fail(self):
|
def test_update_execution_fail(self):
|
||||||
_, execution = self.client.create_execution(self.direct_wf)
|
_, execution = self.client.create_execution(self.direct_wf)
|
||||||
|
@ -145,6 +145,18 @@ class TestExecutionsController(base.FunctionalTest):
|
|||||||
WF_EX_JSON_WITH_DESC
|
WF_EX_JSON_WITH_DESC
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@mock.patch('mistral.db.v2.api.ensure_workflow_execution_exists')
|
||||||
|
@mock.patch('mistral.db.v2.api.update_workflow_execution',
|
||||||
|
return_value=WF_EX)
|
||||||
|
def test_put_description(self, mock_update, mock_ensure):
|
||||||
|
update_params = {'description': 'execution description.'}
|
||||||
|
|
||||||
|
resp = self.app.put_json('/v2/executions/123', update_params)
|
||||||
|
|
||||||
|
self.assertEqual(resp.status_int, 200)
|
||||||
|
mock_ensure.assert_called_once_with('123')
|
||||||
|
mock_update.assert_called_once_with('123', update_params)
|
||||||
|
|
||||||
@mock.patch.object(rpc.EngineClient, 'start_workflow')
|
@mock.patch.object(rpc.EngineClient, 'start_workflow')
|
||||||
def test_post(self, f):
|
def test_post(self, f):
|
||||||
f.return_value = WF_EX.to_dict()
|
f.return_value = WF_EX.to_dict()
|
||||||
|
Loading…
Reference in New Issue
Block a user