From 79eca4756a71fc6ab68ec82697936826e40b6696 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Tue, 11 Dec 2018 21:20:32 +0000 Subject: [PATCH] Fix tests --- openlp/core/ui/mainwindow.py | 7 ++++--- tests/functional/openlp_core/ui/test_mainwindow.py | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index cbf33f17e..933795d29 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -30,6 +30,7 @@ from tempfile import gettempdir from PyQt5 import QtCore, QtGui, QtWidgets +from openlp.core.state import State from openlp.core.api import websockets from openlp.core.api.http import server from openlp.core.common import is_win, is_macosx, add_actions @@ -652,7 +653,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, LogMixin, RegistryPropert Import themes if first time """ self.application.process_events() - for plugin in self.plugin_manager.plugins: + for plugin in State().list_plugins(): if hasattr(plugin, 'first_time'): self.application.process_events() plugin.first_time() @@ -690,7 +691,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, LogMixin, RegistryPropert self.projector_manager_dock.setVisible(True) else: self.projector_manager_dock.setVisible(False) - for plugin in self.plugin_manager.plugins: + for plugin in State().list_plugins(): self.active_plugin = plugin old_status = self.active_plugin.status self.active_plugin.set_status() @@ -864,7 +865,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, LogMixin, RegistryPropert setting_sections.extend([self.header_section]) setting_sections.extend(['crashreport']) # Add plugin sections. - setting_sections.extend([plugin.name for plugin in self.plugin_manager.plugins]) + setting_sections.extend([plugin.name for plugin in State().list_plugins()]) # Copy the settings file to the tmp dir, because we do not want to change the original one. temp_dir_path = Path(gettempdir(), 'openlp') create_paths(temp_dir_path) diff --git a/tests/functional/openlp_core/ui/test_mainwindow.py b/tests/functional/openlp_core/ui/test_mainwindow.py index 7927efacf..37f6d4da1 100644 --- a/tests/functional/openlp_core/ui/test_mainwindow.py +++ b/tests/functional/openlp_core/ui/test_mainwindow.py @@ -162,8 +162,8 @@ class TestMainWindow(TestCase, TestMixin): # WHEN: you check the started functions # THEN: the following registry functions should have been registered - assert len(self.registry.service_list) == 13, \ - 'The registry should have 12 services, got {}'.format(self.registry.service_list.keys()) + assert len(self.registry.service_list) == 8, \ + 'The registry should have 8 services, got {}'.format(self.registry.service_list.keys()) assert len(self.registry.functions_list) == 19, \ 'The registry should have 19 functions, got {}'.format(self.registry.functions_list.keys()) assert 'application' in self.registry.service_list, 'The application should have been registered.'