Add the unit test for cron_triggers detail

Change-Id: I0b63595ff975e08b2e82ed32fbf34d0bc03baf9c
This commit is contained in:
pengyuesheng 2019-06-20 17:33:06 +08:00
parent 1527b4faa7
commit bcc743e559

View File

@ -33,3 +33,15 @@ class CronTriggersTest(test.TestCase):
self.assertTemplateUsed(res, 'mistral/cron_triggers/index.html')
self.mock_cron_trigger_list.assert_called_once_with(
helpers.IsHttpRequest())
@helpers.create_mocks({api: ('cron_trigger_get',)})
def test_detail(self):
cron_trigger = self.mistralclient_cron_triggers.list()[0]
self.mock_cron_trigger_get.return_value = cron_trigger
url = reverse('horizon:mistral:cron_triggers:detail',
args=[cron_trigger.id])
res = self.client.get(url)
self.assertTemplateUsed(res, 'mistral/cron_triggers/detail.html')
self.mock_cron_trigger_get.assert_called_once_with(
helpers.IsHttpRequest(), cron_trigger.id)