diff --git a/mistraldashboard/executions/tests.py b/mistraldashboard/executions/tests.py index 3cbea17..7557e32 100644 --- a/mistraldashboard/executions/tests.py +++ b/mistraldashboard/executions/tests.py @@ -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:executions:index') @@ -22,9 +24,17 @@ INDEX_URL = reverse('horizon:mistral:executions:index') class ExecutionsTest(test.TestCase): + @helpers.create_mocks({api: ('pagination_list',)}) def test_index(self): - with mock.patch('mistraldashboard.api.pagination_list', - return_value=self.mistralclient_executions.list()): - res = self.client.get(INDEX_URL) - + self.mock_pagination_list.return_value =\ + [self.mistralclient_executions.list(), False, False] + res = self.client.get(INDEX_URL) self.assertTemplateUsed(res, 'mistral/executions/index.html') + self.assertItemsEqual(res.context['table'].data, + self.mistralclient_executions.list()) + self.mock_pagination_list.assert_called_once_with( + entity="executions", + request=helpers.IsHttpRequest(), + marker=None, + sort_dirs='desc', + paginate=True)