From 8bceb199d668f2e3e3eacd92eb3936783f04a29b Mon Sep 17 00:00:00 2001 From: pengyuesheng Date: Thu, 20 Jun 2019 17:11:50 +0800 Subject: [PATCH] Add the unit test for action_executions detail Change-Id: I4bc34845cdf33869e840659e9c4138019d6c3575 --- mistraldashboard/action_executions/tests.py | 12 ++++++++++++ mistraldashboard/test/test_data/mistral_data.py | 2 ++ 2 files changed, 14 insertions(+) diff --git a/mistraldashboard/action_executions/tests.py b/mistraldashboard/action_executions/tests.py index f5d6107..0813d79 100644 --- a/mistraldashboard/action_executions/tests.py +++ b/mistraldashboard/action_executions/tests.py @@ -33,3 +33,15 @@ class ActionExecutionsTest(test.TestCase): self.assertTemplateUsed(res, 'mistral/action_executions/index.html') self.mock_action_executions_list.assert_called_once_with( helpers.IsHttpRequest()) + + @helpers.create_mocks({api: ('action_execution_get',)}) + def test_detail(self): + action_execution = self.mistralclient_action_executions.list()[0] + self.mock_action_execution_get.return_value = action_execution + url = reverse('horizon:mistral:action_executions:detail', + args=[action_execution.id]) + res = self.client.get(url) + + self.assertTemplateUsed(res, 'mistral/action_executions/detail.html') + self.mock_action_execution_get.assert_called_once_with( + helpers.IsHttpRequest(), action_execution.id) diff --git a/mistraldashboard/test/test_data/mistral_data.py b/mistraldashboard/test/test_data/mistral_data.py index 12bd3a7..bf2de79 100644 --- a/mistraldashboard/test/test_data/mistral_data.py +++ b/mistraldashboard/test/test_data/mistral_data.py @@ -141,6 +141,8 @@ def data(TEST): 'workflow_name': 'my work flow', 'task_execution_id': '1', 'task_name': 'b', + 'input': "1", + 'output': "1", 'description': '', 'created_at': '1', 'updated_at': '1',