From 5cd8b3bb36ca292f5e09b5f7da11a3f2f4ea0828 Mon Sep 17 00:00:00 2001 From: Ricardo Dias Date: Mon, 15 Jul 2019 16:12:36 +0100 Subject: [PATCH] mgr/dashboard: tests: fix tests by mocking progress service Signed-off-by: Ricardo Dias --- src/pybind/mgr/dashboard/tests/test_rbd_mirroring.py | 4 ++++ src/pybind/mgr/dashboard/tests/test_rest_tasks.py | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/src/pybind/mgr/dashboard/tests/test_rbd_mirroring.py b/src/pybind/mgr/dashboard/tests/test_rbd_mirroring.py index bad16b746b26c..41c1a3852077c 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 191ef812934fb..44bce050a741e 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 -- 2.39.5