Add the unit test for workbooks detail

Change-Id: Idd8a862f396d8edcf26a7e4ba066946ec5f80aa3
This commit is contained in:
pengyuesheng 2019-06-21 10:37:14 +08:00
parent d1df6b3998
commit 21663e507e

View File

@ -134,3 +134,15 @@ class WorkflowsTest(test.TestCase):
helpers.IsHttpRequest())
self.assertNoFormErrors(res)
self.assertRedirectsNoFollow(res, INDEX_URL)
@helpers.create_mocks({api: ('workbook_get',)})
def test_detail(self):
workbook = self.mistralclient_workbooks.list()[0]
self.mock_workbook_get.return_value = workbook
url = reverse('horizon:mistral:workbooks:detail',
args=[workbook.name])
res = self.client.get(url)
self.assertTemplateUsed(res, 'mistral/workbooks/detail.html')
self.mock_workbook_get.assert_called_once_with(
helpers.IsHttpRequest(), workbook.name)