Add the unit test for update_action_execution

Change-Id: I73464cbb8d561ad2d9b30c976fc7afaba6a8b300
This commit is contained in:
pengyuesheng 2019-06-24 10:35:31 +08:00
parent 63f404e38c
commit b7a408a19b
2 changed files with 18 additions and 1 deletions

View File

@ -34,6 +34,23 @@ class ActionExecutionsTest(test.TestCase):
self.mock_action_executions_list.assert_called_once_with(
helpers.IsHttpRequest())
@helpers.create_mocks({api: ('action_execution_update',)})
def test_update_post(self):
action_execution = self.mistralclient_action_executions.first()
self.mock_action_execution_update.return_value = action_execution
form_data = {"action_execution_id": action_execution.id,
"state": action_execution.state,
"output_source": "raw",
"output_data": action_execution.output}
res = self.client.post(
reverse('horizon:mistral:action_executions:update',
args=(action_execution.id,)),
form_data)
self.assertNoFormErrors(res)
self.mock_action_execution_update.assert_called_once_with(
helpers.IsHttpRequest(), action_execution.id,
action_execution.state, action_execution.output)
@helpers.create_mocks({api: ('action_execution_get',)})
def test_detail(self):
action_execution = self.mistralclient_action_executions.list()[0]

View File

@ -146,7 +146,7 @@ def data(TEST):
'created_at': '1',
'updated_at': '1',
'accepted': True,
'state': 'RUNNING'
'state': 'SUCCESS'
}
)
TEST.mistralclient_action_executions.add(action_executions_1)