From 7f799b09d27f88acbee6c18d87d2ce81e6a5c602 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 22 Dec 2018 14:54:35 +0000 Subject: [PATCH] fixes --- tests/interfaces/openlp_core/lib/test_pluginmanager.py | 1 + tests/interfaces/openlp_core/ui/test_mainwindow.py | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/tests/interfaces/openlp_core/lib/test_pluginmanager.py b/tests/interfaces/openlp_core/lib/test_pluginmanager.py index c72d30211..2d0f6e2cd 100644 --- a/tests/interfaces/openlp_core/lib/test_pluginmanager.py +++ b/tests/interfaces/openlp_core/lib/test_pluginmanager.py @@ -76,6 +76,7 @@ class TestPluginManager(TestCase, TestMixin): """ # GIVEN: A plugin manager plugin_manager = PluginManager() + plugin_manager.bootstrap_initialise() # WHEN: We mock out sys.platform to make it return "darwin" and then find the plugins old_platform = sys.platform diff --git a/tests/interfaces/openlp_core/ui/test_mainwindow.py b/tests/interfaces/openlp_core/ui/test_mainwindow.py index 88dedccde..95386f035 100644 --- a/tests/interfaces/openlp_core/ui/test_mainwindow.py +++ b/tests/interfaces/openlp_core/ui/test_mainwindow.py @@ -25,7 +25,11 @@ Package to test the openlp.core.ui.mainwindow package. from unittest import TestCase from unittest.mock import MagicMock, patch +from PyQt5 import QtGui + +from openlp.core.state import State from openlp.core.common.registry import Registry +from openlp.core.lib.plugin import PluginStatus from openlp.core.ui.mainwindow import MainWindow from tests.helpers.testmixin import TestMixin @@ -45,6 +49,11 @@ class TestMainWindow(TestCase, TestMixin): self.app.args = [] Registry().register('application', self.app) Registry().set_flag('no_web_server', True) + mocked_plugin = MagicMock() + mocked_plugin.status = PluginStatus.Active + mocked_plugin.icon = QtGui.QIcon() + Registry().register('mock_plugin', mocked_plugin) + State().add_service("mock", 1, is_plugin=True, status=PluginStatus.Active) # Mock classes and methods used by mainwindow. with patch('openlp.core.ui.mainwindow.SettingsForm'), \ patch('openlp.core.ui.mainwindow.OpenLPDockWidget'), \