This commit is contained in:
Tim Bentley 2018-12-22 14:54:35 +00:00
parent 9027e92e0f
commit 7f799b09d2
2 changed files with 10 additions and 0 deletions

View File

@ -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

View File

@ -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'), \