From a64036c8c1a6d1125a8360bccec4b0d4aaecb664 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Tue, 11 Dec 2018 21:01:03 +0000 Subject: [PATCH] Fix tests --- tests/functional/openlp_core/lib/test_serviceitem.py | 2 +- tests/functional/openlp_core/ui/test_maindisplay.py | 3 --- tests/functional/openlp_core/ui/test_mainwindow.py | 5 +++++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/functional/openlp_core/lib/test_serviceitem.py b/tests/functional/openlp_core/lib/test_serviceitem.py index 2aaa887bb..4a61dd737 100644 --- a/tests/functional/openlp_core/lib/test_serviceitem.py +++ b/tests/functional/openlp_core/lib/test_serviceitem.py @@ -222,7 +222,7 @@ class TestServiceItem(TestCase, TestMixin): assert frame_array2 == service_item2.get_frames()[0], 'The return should match the frame array2' assert test_file1 == str(service_item.get_frame_path(0)), \ 'The frame path should match the full path to the image' - assert test_file2 == service_item2.get_frame_path(0), \ + assert test_file2 == str(service_item2.get_frame_path(0)), \ 'The frame path should match the full path to the image' assert image_name1 == service_item.get_frame_title(0), 'The 1st frame title should match the image name' assert image_name2 == service_item2.get_frame_title(0), 'The 2nd frame title should match the image name' diff --git a/tests/functional/openlp_core/ui/test_maindisplay.py b/tests/functional/openlp_core/ui/test_maindisplay.py index 5226e127e..3e69738bf 100644 --- a/tests/functional/openlp_core/ui/test_maindisplay.py +++ b/tests/functional/openlp_core/ui/test_maindisplay.py @@ -60,14 +60,11 @@ class TestMainDisplay(TestCase, TestMixin): self.registry = Registry() self.setup_application() Registry().register('application', self.app) - self.mocked_audio_player = patch('openlp.core.ui.maindisplay.AudioPlayer') - self.mocked_audio_player.start() def tearDown(self): """ Delete QApplication. """ - self.mocked_audio_player.stop() del self.screens def test_initial_main_display(self): diff --git a/tests/functional/openlp_core/ui/test_mainwindow.py b/tests/functional/openlp_core/ui/test_mainwindow.py index 888ac435d..6d90cddd9 100644 --- a/tests/functional/openlp_core/ui/test_mainwindow.py +++ b/tests/functional/openlp_core/ui/test_mainwindow.py @@ -32,6 +32,7 @@ from PyQt5 import QtCore, QtWidgets from openlp.core.common.i18n import UiStrings from openlp.core.common.registry import Registry from openlp.core.display.screens import ScreenList +from openlp.core.lib.plugin import PluginStatus from openlp.core.ui.mainwindow import MainWindow from tests.helpers.testmixin import TestMixin from tests.utils.constants import TEST_RESOURCES_PATH @@ -68,6 +69,10 @@ class TestMainWindow(TestCase, TestMixin): self.add_toolbar_action_patcher = patch('openlp.core.ui.mainwindow.create_action') self.mocked_add_toolbar_action = self.add_toolbar_action_patcher.start() self.mocked_add_toolbar_action.side_effect = self._create_mock_action + mocked_plugin = MagicMock() + mocked_plugin.status = PluginStatus.Active + Registry().register('mock_plugin', mocked_plugin) + State().add_service("mock", 1, is_plugin=True, status=PluginStatus.Active) with patch('openlp.core.display.screens.ScreenList.__instance__', spec=ScreenList) as mocked_screen_list: mocked_screen_list.current = {'number': 0, 'size': QtCore.QSize(600, 800), 'primary': True} self.main_window = MainWindow()