Add the unit test for actions detail

Change-Id: Iafe4d0459b4e89111f63e594f00163419dfdfc70
This commit is contained in:
pengyuesheng 2019-06-20 16:38:03 +08:00
parent 1527b4faa7
commit d1df6b3998

View File

@ -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)