Merge "fix the Bug of test in cron_triggers panel"

This commit is contained in:
Zuul 2019-06-14 13:50:01 +00:00 committed by Gerrit Code Review
commit bd5f514bbd
1 changed files with 9 additions and 5 deletions

View File

@ -13,8 +13,10 @@
# under the License.
from django.urls import reverse
import mock
from openstack_dashboard.test import helpers
from mistraldashboard import api
from mistraldashboard.test import helpers as test
INDEX_URL = reverse('horizon:mistral:cron_triggers:index')
@ -22,10 +24,12 @@ INDEX_URL = reverse('horizon:mistral:cron_triggers:index')
class CronTriggersTest(test.TestCase):
@helpers.create_mocks({api: ('cron_trigger_list',)})
def test_index(self):
with mock.patch('mistraldashboard.api.cron_trigger_list',
return_value=self.
mistralclient_cron_triggers.list()):
res = self.client.get(INDEX_URL)
self.mock_cron_trigger_list.return_value =\
self.mistralclient_cron_triggers.list()
res = self.client.get(INDEX_URL)
self.assertTemplateUsed(res, 'mistral/cron_triggers/index.html')
self.mock_cron_trigger_list.assert_called_once_with(
helpers.IsHttpRequest())