Fix tests

This commit is contained in:
Tim Bentley 2018-12-11 21:01:03 +00:00
parent 36fd65f98c
commit a64036c8c1
3 changed files with 6 additions and 4 deletions

View File

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

View File

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

View File

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