From: Ricardo Dias Date: Mon, 15 Jul 2019 15:12:36 +0000 (+0100) Subject: mgr/dashboard: tests: fix tests by mocking progress service X-Git-Tag: v15.1.0~2173^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5cd8b3bb36ca292f5e09b5f7da11a3f2f4ea0828;p=ceph.git mgr/dashboard: tests: fix tests by mocking progress service Signed-off-by: Ricardo Dias --- diff --git a/src/pybind/mgr/dashboard/tests/test_rbd_mirroring.py b/src/pybind/mgr/dashboard/tests/test_rbd_mirroring.py index bad16b746b26..41c1a3852077 100644 --- a/src/pybind/mgr/dashboard/tests/test_rbd_mirroring.py +++ b/src/pybind/mgr/dashboard/tests/test_rbd_mirroring.py @@ -7,6 +7,7 @@ from . import ControllerTestCase from .. import mgr from ..controllers.summary import Summary from ..controllers.rbd_mirroring import RbdMirroringSummary +from ..services import progress mock_list_servers = [{ @@ -67,6 +68,9 @@ class RbdMirroringSummaryControllerTest(ControllerTestCase): '(23d3751b897b31d2bda57aeaf01acb5ff3c4a9cd) ' \ 'nautilus (dev)' + progress.get_progress_tasks = mock.MagicMock() + progress.get_progress_tasks.return_value = ([], []) + # pylint: disable=protected-access RbdMirroringSummary._cp_config['tools.authenticate.on'] = False Summary._cp_config['tools.authenticate.on'] = False diff --git a/src/pybind/mgr/dashboard/tests/test_rest_tasks.py b/src/pybind/mgr/dashboard/tests/test_rest_tasks.py index 191ef812934f..44bce050a741 100644 --- a/src/pybind/mgr/dashboard/tests/test_rest_tasks.py +++ b/src/pybind/mgr/dashboard/tests/test_rest_tasks.py @@ -3,9 +3,12 @@ import time +import mock + from . import ControllerTestCase from ..controllers import Controller, RESTController, Task from ..controllers.task import Task as TaskController +from ..services import progress from ..tools import NotificationQueue, TaskManager @@ -48,6 +51,9 @@ class TaskControllerTest(ControllerTestCase): @classmethod def setup_server(cls): # pylint: disable=protected-access + progress.get_progress_tasks = mock.MagicMock() + progress.get_progress_tasks.return_value = ([], []) + NotificationQueue.start_queue() TaskManager.init() TaskTest._cp_config['tools.authenticate.on'] = False