From d1df6b399896cd161fa361fc5d52e86446441f7a Mon Sep 17 00:00:00 2001 From: pengyuesheng Date: Thu, 20 Jun 2019 16:38:03 +0800 Subject: [PATCH] Add the unit test for actions detail Change-Id: Iafe4d0459b4e89111f63e594f00163419dfdfc70 --- mistraldashboard/actions/tests.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mistraldashboard/actions/tests.py b/mistraldashboard/actions/tests.py index 438dfb3..7bffefc 100644 --- a/mistraldashboard/actions/tests.py +++ b/mistraldashboard/actions/tests.py @@ -34,3 +34,15 @@ class ActionsTest(test.TestCase): entity="actions", request=horizon_test.IsHttpRequest(), marker=None, sort_keys='name', sort_dirs='desc', paginate=True, reversed_order=True) + + @horizon_test.create_mocks({api: ('action_get',)}) + def test_detail(self): + action = self.mistralclient_actions.list()[0] + self.mock_action_get.return_value = action + url = reverse('horizon:mistral:actions:detail', + args=[action.id]) + res = self.client.get(url) + + self.assertTemplateUsed(res, 'mistral/actions/detail.html') + self.mock_action_get.assert_called_once_with( + horizon_test.IsHttpRequest(), action.id)