Merge "Add the unit test for executions detail"

This commit is contained in:
Zuul 2019-06-21 05:19:04 +00:00 committed by Gerrit Code Review
commit 050a8d0838
2 changed files with 20 additions and 6 deletions

View File

@ -38,3 +38,19 @@ class ExecutionsTest(test.TestCase):
marker=None, marker=None,
sort_dirs='desc', sort_dirs='desc',
paginate=True) paginate=True)
@helpers.create_mocks({api: ('execution_get', 'task_list')})
def test_detail(self):
execution = self.mistralclient_executions.list()[0]
tasks = self.mistralclient_tasks.list()
self.mock_execution_get.return_value = execution
self.mock_task_list.return_value = tasks
url = reverse('horizon:mistral:executions:detail',
args=[execution.id])
res = self.client.get(url)
self.assertTemplateUsed(res, 'mistral/executions/detail.html')
self.mock_execution_get.assert_called_once_with(
helpers.IsHttpRequest(), execution.id)
self.mock_task_list.assert_called_once_with(
helpers.IsHttpRequest(), execution.id)

View File

@ -83,12 +83,10 @@ def data(TEST):
'workflow_name': 'my_wf', 'workflow_name': 'my_wf',
'description': '', 'description': '',
'state': 'RUNNING', 'state': 'RUNNING',
'input': { 'input': '{"person": {"first_name": "John", "last_name": "Doe"}}',
'person': { 'output': "1",
'first_name': 'John', 'params': "1",
'last_name': 'Doe'
} }
}}
) )
TEST.mistralclient_executions.add(execution_1) TEST.mistralclient_executions.add(execution_1)