forked from openlp/openlp
Mock comes with Python as of 3.3, and I don't think there is anyone using lower than 3.3, so let's use Python's mock directly now.
Windows tests are failing due to file sharing (we've had this issue before), unrelated to my changes. Add this to your merge proposal: -------------------------------- lp:~raoul-snyman/openlp/refactor-mock (revision 2734) [SUCCESS] https://ci.openlp.io/job/Branch-01-Pull/1992/ [SUCCESS] https://ci.openlp.io/job/Branch-02-Functional-Tests/1902/ [SUCCESS] https://... bzr-revno: 2733
This commit is contained in:
commit
d74c9c0c81
@ -25,13 +25,8 @@ Base directory for tests
|
|||||||
import sys
|
import sys
|
||||||
from PyQt5 import QtWidgets
|
from PyQt5 import QtWidgets
|
||||||
|
|
||||||
if sys.version_info[1] >= 3:
|
|
||||||
from unittest.mock import ANY, MagicMock, patch, mock_open, call, PropertyMock
|
|
||||||
else:
|
|
||||||
from mock import ANY, MagicMock, patch, mock_open, call, PropertyMock
|
|
||||||
|
|
||||||
# Only one QApplication can be created. Use QtWidgets.QApplication.instance() when you need to "create" a QApplication.
|
# Only one QApplication can be created. Use QtWidgets.QApplication.instance() when you need to "create" a QApplication.
|
||||||
application = QtWidgets.QApplication([])
|
application = QtWidgets.QApplication([])
|
||||||
application.setApplicationName('OpenLP')
|
application.setApplicationName('OpenLP')
|
||||||
|
|
||||||
__all__ = ['ANY', 'MagicMock', 'patch', 'mock_open', 'call', 'application', 'PropertyMock']
|
__all__ = ['application']
|
||||||
|
@ -23,12 +23,13 @@
|
|||||||
Package to test the openlp.core.common.actions package.
|
Package to test the openlp.core.common.actions package.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock
|
||||||
|
|
||||||
from PyQt5 import QtGui, QtCore, QtWidgets
|
from PyQt5 import QtGui, QtCore, QtWidgets
|
||||||
|
|
||||||
from openlp.core.common import Settings
|
from openlp.core.common import Settings
|
||||||
from openlp.core.common.actions import CategoryActionList, ActionList
|
from openlp.core.common.actions import CategoryActionList, ActionList
|
||||||
from tests.functional import MagicMock
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,9 +25,9 @@ Functional tests to test the AppLocation class and related methods.
|
|||||||
import copy
|
import copy
|
||||||
import os
|
import os
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
from openlp.core.common import AppLocation, get_frozen_path
|
from openlp.core.common import AppLocation, get_frozen_path
|
||||||
from tests.functional import patch
|
|
||||||
|
|
||||||
FILE_LIST = ['file1', 'file2', 'file3.txt', 'file4.txt', 'file5.mp3', 'file6.mp3']
|
FILE_LIST = ['file1', 'file2', 'file3.txt', 'file4.txt', 'file5.mp3', 'file6.mp3']
|
||||||
|
|
||||||
|
@ -22,12 +22,11 @@
|
|||||||
"""
|
"""
|
||||||
Functional tests to test the AppLocation class and related methods.
|
Functional tests to test the AppLocation class and related methods.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from openlp.core.common import check_directory_exists, de_hump, trace_error_handler, translate, is_win, is_macosx, \
|
from openlp.core.common import check_directory_exists, de_hump, trace_error_handler, translate, is_win, is_macosx, \
|
||||||
is_linux, clean_button_text
|
is_linux, clean_button_text
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
|
|
||||||
|
|
||||||
class TestCommonFunctions(TestCase):
|
class TestCommonFunctions(TestCase):
|
||||||
|
@ -26,10 +26,10 @@ import os
|
|||||||
import tempfile
|
import tempfile
|
||||||
import socket
|
import socket
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from openlp.core.common.httputils import get_user_agent, get_web_page, get_url_file_size, url_get_file
|
from openlp.core.common.httputils import get_user_agent, get_web_page, get_url_file_size, url_get_file
|
||||||
|
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,10 +25,11 @@ Functional tests to test the AppLocation class and related methods.
|
|||||||
import os
|
import os
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, PropertyMock, call, patch
|
||||||
|
|
||||||
from openlp.core.common import add_actions, clean_filename, delete_file, get_file_encoding, get_filesystem_encoding, \
|
from openlp.core.common import add_actions, clean_filename, delete_file, get_file_encoding, get_filesystem_encoding, \
|
||||||
get_uno_command, get_uno_instance, split_filename
|
get_uno_command, get_uno_instance, split_filename
|
||||||
from tests.functional import MagicMock, PropertyMock, call, patch
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,8 +23,8 @@
|
|||||||
Functional tests to test the AppLocation class and related methods.
|
Functional tests to test the AppLocation class and related methods.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
from tests.functional import patch
|
|
||||||
from openlp.core.common.languagemanager import get_locale_key, get_natural_key
|
from openlp.core.common.languagemanager import get_locale_key, get_natural_key
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,9 +24,9 @@ Package to test the openlp.core.lib package.
|
|||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock
|
||||||
|
|
||||||
from openlp.core.common import Registry
|
from openlp.core.common import Registry
|
||||||
from tests.functional import MagicMock
|
|
||||||
|
|
||||||
TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '../', '..', 'resources'))
|
TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '../', '..', 'resources'))
|
||||||
|
|
||||||
|
@ -23,11 +23,10 @@
|
|||||||
Test the registry properties
|
Test the registry properties
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from openlp.core.common import Registry, RegistryProperties
|
from openlp.core.common import Registry, RegistryProperties
|
||||||
|
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
|
|
||||||
|
|
||||||
class TestRegistryProperties(TestCase, RegistryProperties):
|
class TestRegistryProperties(TestCase, RegistryProperties):
|
||||||
"""
|
"""
|
||||||
|
@ -23,10 +23,11 @@
|
|||||||
Package to test the openlp.core.lib.settings package.
|
Package to test the openlp.core.lib.settings package.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
from openlp.core.common import Settings
|
from openlp.core.common import Settings
|
||||||
from openlp.core.common.settings import recent_files_conv
|
from openlp.core.common.settings import recent_files_conv
|
||||||
from tests.functional import patch
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,10 +23,11 @@
|
|||||||
Package to test the openlp.core.common.versionchecker package.
|
Package to test the openlp.core.common.versionchecker package.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from openlp.core.common.settings import Settings
|
from openlp.core.common.settings import Settings
|
||||||
from openlp.core.common.versionchecker import VersionThread
|
from openlp.core.common.versionchecker import VersionThread
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,13 +24,13 @@ Package to test the openlp.core.lib package.
|
|||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import patch, MagicMock
|
||||||
|
|
||||||
from sqlalchemy.pool import NullPool
|
from sqlalchemy.pool import NullPool
|
||||||
from sqlalchemy.orm.scoping import ScopedSession
|
from sqlalchemy.orm.scoping import ScopedSession
|
||||||
from sqlalchemy import MetaData
|
from sqlalchemy import MetaData
|
||||||
|
|
||||||
from openlp.core.lib.db import init_db, get_upgrade_op, delete_database
|
from openlp.core.lib.db import init_db, get_upgrade_op, delete_database
|
||||||
from tests.functional import patch, MagicMock
|
|
||||||
|
|
||||||
|
|
||||||
class TestDB(TestCase):
|
class TestDB(TestCase):
|
||||||
|
@ -1,11 +1,31 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
# Copyright (c) 2008-2017 OpenLP Developers #
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
# This program is free software; you can redistribute it and/or modify it #
|
||||||
|
# under the terms of the GNU General Public License as published by the Free #
|
||||||
|
# Software Foundation; version 2 of the License. #
|
||||||
|
# #
|
||||||
|
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
||||||
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
||||||
|
# more details. #
|
||||||
|
# #
|
||||||
|
# You should have received a copy of the GNU General Public License along #
|
||||||
|
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||||
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
|
###############################################################################
|
||||||
"""
|
"""
|
||||||
Package to test the openlp.core.lib.filedialog package.
|
Package to test the openlp.core.lib.filedialog package.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, call, patch
|
||||||
|
|
||||||
from openlp.core.common import UiStrings
|
|
||||||
from openlp.core.lib.filedialog import FileDialog
|
from openlp.core.lib.filedialog import FileDialog
|
||||||
from tests.functional import MagicMock, call, patch
|
|
||||||
|
|
||||||
|
|
||||||
class TestFileDialog(TestCase):
|
class TestFileDialog(TestCase):
|
||||||
|
@ -24,10 +24,9 @@ Package to test the openlp.core.lib.formattingtags package.
|
|||||||
"""
|
"""
|
||||||
import copy
|
import copy
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
from openlp.core.lib import FormattingTags
|
from openlp.core.lib import FormattingTags
|
||||||
from tests.functional import patch
|
|
||||||
|
|
||||||
|
|
||||||
TAG = {
|
TAG = {
|
||||||
'end tag': '{/aa}',
|
'end tag': '{/aa}',
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
"""
|
"""
|
||||||
Package to test the openlp.core.lib.htmlbuilder module.
|
Package to test the openlp.core.lib.htmlbuilder module.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from PyQt5 import QtCore, QtWebKit
|
from PyQt5 import QtCore, QtWebKit
|
||||||
|
|
||||||
@ -10,7 +10,7 @@ from openlp.core.common import Settings
|
|||||||
from openlp.core.lib.htmlbuilder import build_html, build_background_css, build_lyrics_css, build_lyrics_outline_css, \
|
from openlp.core.lib.htmlbuilder import build_html, build_background_css, build_lyrics_css, build_lyrics_outline_css, \
|
||||||
build_lyrics_format_css, build_footer_css, webkit_version
|
build_lyrics_format_css, build_footer_css, webkit_version
|
||||||
from openlp.core.lib.theme import HorizontalType, VerticalType
|
from openlp.core.lib.theme import HorizontalType, VerticalType
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
HTML = """
|
HTML = """
|
||||||
|
@ -25,14 +25,15 @@ Package to test the openlp.core.ui package.
|
|||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
from threading import Lock
|
from threading import Lock
|
||||||
|
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
from PyQt5 import QtGui
|
from PyQt5 import QtGui
|
||||||
|
|
||||||
from openlp.core.common import Registry
|
from openlp.core.common import Registry
|
||||||
from openlp.core.lib import ImageManager, ScreenList
|
from openlp.core.lib import ImageManager, ScreenList
|
||||||
from openlp.core.lib.imagemanager import Priority
|
from openlp.core.lib.imagemanager import Priority
|
||||||
from tests.functional import patch
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'resources'))
|
TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'resources'))
|
||||||
|
@ -23,15 +23,14 @@
|
|||||||
Package to test the openlp.core.lib package.
|
Package to test the openlp.core.lib package.
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from unittest import TestCase
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from PyQt5 import QtCore, QtGui
|
from PyQt5 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import build_icon, check_item_selected, clean_tags, create_thumb, create_separated_list, \
|
from openlp.core.lib import build_icon, check_item_selected, clean_tags, create_thumb, create_separated_list, \
|
||||||
expand_tags, get_text_file_string, image_to_byte, resize_image, str_to_bool, validate_thumb
|
expand_tags, get_text_file_string, image_to_byte, resize_image, str_to_bool, validate_thumb
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
|
|
||||||
TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'resources'))
|
TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'resources'))
|
||||||
|
|
||||||
|
@ -23,10 +23,10 @@
|
|||||||
Package to test the openlp.core.lib.mediamanageritem package.
|
Package to test the openlp.core.lib.mediamanageritem package.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem
|
from openlp.core.lib import MediaManagerItem
|
||||||
|
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,11 +23,11 @@
|
|||||||
Package to test the openlp.core.lib.pluginmanager package.
|
Package to test the openlp.core.lib.pluginmanager package.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock
|
||||||
|
|
||||||
from openlp.core.common import Registry, Settings
|
from openlp.core.common import Registry, Settings
|
||||||
from openlp.core.lib.pluginmanager import PluginManager
|
from openlp.core.lib.pluginmanager import PluginManager
|
||||||
from openlp.core.lib import PluginStatus
|
from openlp.core.lib import PluginStatus
|
||||||
from tests.functional import MagicMock
|
|
||||||
|
|
||||||
|
|
||||||
class TestPluginManager(TestCase):
|
class TestPluginManager(TestCase):
|
||||||
|
@ -22,14 +22,12 @@
|
|||||||
"""
|
"""
|
||||||
Package to test the openlp.core.lib.projector.pjlink1 package.
|
Package to test the openlp.core.lib.projector.pjlink1 package.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import patch, MagicMock
|
||||||
|
|
||||||
from openlp.core.lib.projector.pjlink1 import PJLink1
|
from openlp.core.lib.projector.pjlink1 import PJLink1
|
||||||
from openlp.core.lib.projector.constants import E_PARAMETER, ERROR_STRING, S_OFF, S_STANDBY, S_WARMUP, S_ON, \
|
from openlp.core.lib.projector.constants import E_PARAMETER, ERROR_STRING, S_OFF, S_STANDBY, S_ON, PJLINK_POWR_STATUS
|
||||||
S_COOLDOWN, PJLINK_POWR_STATUS
|
|
||||||
|
|
||||||
from tests.functional import patch, MagicMock
|
|
||||||
from tests.resources.projector.data import TEST_PIN, TEST_SALT, TEST_CONNECT_AUTHENTICATE, TEST_HASH
|
from tests.resources.projector.data import TEST_PIN, TEST_SALT, TEST_CONNECT_AUTHENTICATE, TEST_HASH
|
||||||
|
|
||||||
pjlink_test = PJLink1(name='test', ip='127.0.0.1', pin=TEST_PIN, no_poll=True)
|
pjlink_test = PJLink1(name='test', ip='127.0.0.1', pin=TEST_PIN, no_poll=True)
|
||||||
|
@ -27,11 +27,11 @@ PREREQUISITE: add_record() and get_all() functions validated.
|
|||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from openlp.core.lib.projector.db import Manufacturer, Model, Projector, ProjectorDB, ProjectorSource, Source
|
from openlp.core.lib.projector.db import Manufacturer, Model, Projector, ProjectorDB, ProjectorSource, Source
|
||||||
from openlp.core.lib.projector.constants import PJLINK_PORT
|
from openlp.core.lib.projector.constants import PJLINK_PORT
|
||||||
|
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
from tests.resources.projector.data import TEST_DB, TEST1_DATA, TEST2_DATA, TEST3_DATA
|
from tests.resources.projector.data import TEST_DB, TEST1_DATA, TEST2_DATA, TEST3_DATA
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
Package to test the openlp.core.ui.renderer package.
|
Package to test the openlp.core.ui.renderer package.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from PyQt5 import QtCore
|
from PyQt5 import QtCore
|
||||||
|
|
||||||
@ -31,7 +32,6 @@ from openlp.core.lib import Renderer, ScreenList, ServiceItem, FormattingTags
|
|||||||
from openlp.core.lib.renderer import words_split, get_start_tags
|
from openlp.core.lib.renderer import words_split, get_start_tags
|
||||||
from openlp.core.lib.theme import ThemeXML
|
from openlp.core.lib.theme import ThemeXML
|
||||||
|
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
|
|
||||||
SCREEN = {
|
SCREEN = {
|
||||||
'primary': False,
|
'primary': False,
|
||||||
|
@ -23,12 +23,12 @@
|
|||||||
Package to test the openlp.core.lib.screenlist package.
|
Package to test the openlp.core.lib.screenlist package.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock
|
||||||
|
|
||||||
from PyQt5 import QtCore, QtWidgets
|
from PyQt5 import QtCore, QtWidgets
|
||||||
|
|
||||||
from openlp.core.common import Registry
|
from openlp.core.common import Registry
|
||||||
from openlp.core.lib import ScreenList
|
from openlp.core.lib import ScreenList
|
||||||
from tests.functional import MagicMock
|
|
||||||
|
|
||||||
SCREEN = {
|
SCREEN = {
|
||||||
'primary': False,
|
'primary': False,
|
||||||
|
@ -24,13 +24,13 @@ Package to test the openlp.core.lib package.
|
|||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
from tests.utils import assert_length, convert_file_service_item
|
|
||||||
|
|
||||||
from openlp.core.common import Registry, md5_hash
|
from openlp.core.common import Registry, md5_hash
|
||||||
from openlp.core.lib import ItemCapabilities, ServiceItem, ServiceItemType
|
from openlp.core.lib import ItemCapabilities, ServiceItem, ServiceItemType
|
||||||
|
|
||||||
|
from tests.utils import assert_length, convert_file_service_item
|
||||||
|
|
||||||
VERSE = 'The Lord said to {r}Noah{/r}: \n'\
|
VERSE = 'The Lord said to {r}Noah{/r}: \n'\
|
||||||
'There\'s gonna be a {su}floody{/su}, {sb}floody{/sb}\n'\
|
'There\'s gonna be a {su}floody{/su}, {sb}floody{/sb}\n'\
|
||||||
'The Lord said to {g}Noah{/g}:\n'\
|
'The Lord said to {g}Noah{/g}:\n'\
|
||||||
|
@ -22,14 +22,15 @@
|
|||||||
"""
|
"""
|
||||||
Package to test the openlp.core.lib.ui package.
|
Package to test the openlp.core.lib.ui package.
|
||||||
"""
|
"""
|
||||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
from openlp.core.common import UiStrings, translate
|
from openlp.core.common import UiStrings, translate
|
||||||
from openlp.core.lib.ui import add_welcome_page, create_button_box, create_horizontal_adjusting_combo_box, \
|
from openlp.core.lib.ui import add_welcome_page, create_button_box, create_horizontal_adjusting_combo_box, \
|
||||||
create_button, create_action, create_valign_selection_widgets, find_and_set_in_combo_box, create_widget_action, \
|
create_button, create_action, create_valign_selection_widgets, find_and_set_in_combo_box, create_widget_action, \
|
||||||
set_case_insensitive_completer
|
set_case_insensitive_completer
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
|
|
||||||
|
|
||||||
class TestUi(TestCase):
|
class TestUi(TestCase):
|
||||||
|
@ -24,10 +24,10 @@ Package to test the openlp.core.ui.firsttimeform package.
|
|||||||
"""
|
"""
|
||||||
import datetime
|
import datetime
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
from openlp.core.ui.aboutform import AboutForm
|
from openlp.core.ui.aboutform import AboutForm
|
||||||
|
|
||||||
from tests.functional import patch
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,15 +26,13 @@ Package to test the openlp.core.ui.exeptionform package.
|
|||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
from unittest.mock import mock_open
|
from unittest.mock import mock_open, patch
|
||||||
|
|
||||||
from openlp.core.common import Registry
|
from openlp.core.common import Registry
|
||||||
|
|
||||||
from tests.functional import patch
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
|
||||||
|
|
||||||
from openlp.core.ui import exceptionform
|
from openlp.core.ui import exceptionform
|
||||||
|
|
||||||
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
exceptionform.WEBKIT_VERSION = 'Webkit Test'
|
exceptionform.WEBKIT_VERSION = 'Webkit Test'
|
||||||
exceptionform.MIGRATE_VERSION = 'Migrate Test'
|
exceptionform.MIGRATE_VERSION = 'Migrate Test'
|
||||||
exceptionform.CHARDET_VERSION = 'CHARDET Test'
|
exceptionform.CHARDET_VERSION = 'CHARDET Test'
|
||||||
|
@ -22,17 +22,16 @@
|
|||||||
"""
|
"""
|
||||||
Package to test the openlp.core.utils.__init__ package.
|
Package to test the openlp.core.utils.__init__ package.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from unittest import TestCase
|
|
||||||
import urllib.request
|
import urllib.request
|
||||||
import urllib.error
|
import urllib.error
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
|
from unittest import TestCase
|
||||||
from tests.functional import patch
|
from unittest.mock import patch
|
||||||
from tests.helpers.testmixin import TestMixin
|
|
||||||
|
|
||||||
from openlp.core.common.httputils import CONNECTION_RETRIES, get_web_page
|
from openlp.core.common.httputils import CONNECTION_RETRIES, get_web_page
|
||||||
|
|
||||||
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
|
|
||||||
class TestFirstTimeWizard(TestMixin, TestCase):
|
class TestFirstTimeWizard(TestMixin, TestCase):
|
||||||
"""
|
"""
|
||||||
|
@ -26,11 +26,11 @@ import os
|
|||||||
import tempfile
|
import tempfile
|
||||||
import urllib
|
import urllib
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from openlp.core.common import Registry
|
from openlp.core.common import Registry
|
||||||
from openlp.core.ui.firsttimeform import FirstTimeForm
|
from openlp.core.ui.firsttimeform import FirstTimeForm
|
||||||
|
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
FAKE_CONFIG = b"""
|
FAKE_CONFIG = b"""
|
||||||
|
@ -23,8 +23,7 @@
|
|||||||
Package to test the openlp.core.ui.formattingtagsform package.
|
Package to test the openlp.core.ui.formattingtagsform package.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch, call
|
||||||
from tests.functional import MagicMock, patch, call
|
|
||||||
|
|
||||||
from openlp.core.ui.formattingtagform import FormattingTagForm
|
from openlp.core.ui.formattingtagform import FormattingTagForm
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
Package to test the openlp.core.ui.slidecontroller package.
|
Package to test the openlp.core.ui.slidecontroller package.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase, skipUnless
|
from unittest import TestCase, skipUnless
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from PyQt5 import QtCore
|
from PyQt5 import QtCore
|
||||||
|
|
||||||
@ -33,11 +34,9 @@ from openlp.core.ui.media import MediaController
|
|||||||
from openlp.core.ui.maindisplay import TRANSPARENT_STYLESHEET, OPAQUE_STYLESHEET
|
from openlp.core.ui.maindisplay import TRANSPARENT_STYLESHEET, OPAQUE_STYLESHEET
|
||||||
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
|
|
||||||
if is_macosx():
|
if is_macosx():
|
||||||
from ctypes import pythonapi, c_void_p, c_char_p, py_object
|
from ctypes import pythonapi, c_void_p, c_char_p, py_object
|
||||||
|
|
||||||
from sip import voidptr
|
from sip import voidptr
|
||||||
from objc import objc_object
|
from objc import objc_object
|
||||||
from AppKit import NSMainMenuWindowLevel, NSWindowCollectionBehaviorManaged
|
from AppKit import NSMainMenuWindowLevel, NSWindowCollectionBehaviorManaged
|
||||||
|
@ -23,8 +23,8 @@
|
|||||||
Package to test openlp.core.ui.mainwindow package.
|
Package to test openlp.core.ui.mainwindow package.
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from PyQt5 import QtWidgets
|
from PyQt5 import QtWidgets
|
||||||
|
|
||||||
@ -32,7 +32,6 @@ from openlp.core.ui.mainwindow import MainWindow
|
|||||||
from openlp.core.lib.ui import UiStrings
|
from openlp.core.lib.ui import UiStrings
|
||||||
from openlp.core.common.registry import Registry
|
from openlp.core.common.registry import Registry
|
||||||
|
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
from tests.utils.constants import TEST_RESOURCES_PATH
|
from tests.utils.constants import TEST_RESOURCES_PATH
|
||||||
|
|
||||||
|
@ -22,12 +22,13 @@
|
|||||||
"""
|
"""
|
||||||
Package to test the openlp.core.ui package.
|
Package to test the openlp.core.ui package.
|
||||||
"""
|
"""
|
||||||
from PyQt5 import QtCore
|
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
from PyQt5 import QtCore
|
||||||
|
|
||||||
from openlp.core.ui.media import get_media_players, parse_optical_path
|
from openlp.core.ui.media import get_media_players, parse_optical_path
|
||||||
|
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,15 +24,14 @@ Package to test the openlp.core.ui.slidecontroller package.
|
|||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
import PyQt5
|
import PyQt5
|
||||||
|
|
||||||
from openlp.core.common import Registry, ThemeLevel
|
from openlp.core.common import Registry, ThemeLevel
|
||||||
from openlp.core.ui.lib.toolbar import OpenLPToolbar
|
|
||||||
from openlp.core.lib import ServiceItem, ServiceItemType, ItemCapabilities
|
from openlp.core.lib import ServiceItem, ServiceItemType, ItemCapabilities
|
||||||
from openlp.core.ui import ServiceManager
|
from openlp.core.ui import ServiceManager
|
||||||
|
from openlp.core.ui.lib.toolbar import OpenLPToolbar
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
|
|
||||||
|
|
||||||
class TestServiceManager(TestCase):
|
class TestServiceManager(TestCase):
|
||||||
|
@ -22,14 +22,14 @@
|
|||||||
"""
|
"""
|
||||||
Package to test the openlp.core.ui.settingsform package.
|
Package to test the openlp.core.ui.settingsform package.
|
||||||
"""
|
"""
|
||||||
from PyQt5 import QtWidgets
|
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
|
from PyQt5 import QtWidgets
|
||||||
|
|
||||||
from openlp.core.common import Registry
|
from openlp.core.common import Registry
|
||||||
from openlp.core.ui.settingsform import SettingsForm
|
from openlp.core.ui.settingsform import SettingsForm
|
||||||
|
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
|
|
||||||
|
|
||||||
class TestSettingsForm(TestCase):
|
class TestSettingsForm(TestCase):
|
||||||
|
|
||||||
|
@ -22,12 +22,12 @@
|
|||||||
"""
|
"""
|
||||||
Package to test the openlp.core.ui.shortcutlistdialog package.
|
Package to test the openlp.core.ui.shortcutlistdialog package.
|
||||||
"""
|
"""
|
||||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
from unittest.mock import MagicMock
|
||||||
|
|
||||||
|
from PyQt5 import QtCore
|
||||||
|
|
||||||
from openlp.core.ui.shortcutlistdialog import CaptureShortcutButton, ShortcutTreeWidget
|
from openlp.core.ui.shortcutlistdialog import CaptureShortcutButton, ShortcutTreeWidget
|
||||||
|
|
||||||
from tests.interfaces import MagicMock, patch
|
|
||||||
|
|
||||||
|
|
||||||
def test_key_press_event():
|
def test_key_press_event():
|
||||||
"""
|
"""
|
||||||
|
@ -22,16 +22,16 @@
|
|||||||
"""
|
"""
|
||||||
Package to test the openlp.core.ui.slidecontroller package.
|
Package to test the openlp.core.ui.slidecontroller package.
|
||||||
"""
|
"""
|
||||||
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from PyQt5 import QtCore, QtGui
|
from PyQt5 import QtCore, QtGui
|
||||||
|
|
||||||
from unittest import TestCase
|
|
||||||
from openlp.core import Registry
|
from openlp.core import Registry
|
||||||
from openlp.core.lib import ImageSource, ServiceItemAction
|
from openlp.core.lib import ImageSource, ServiceItemAction
|
||||||
from openlp.core.ui import SlideController, LiveController, PreviewController
|
from openlp.core.ui import SlideController, LiveController, PreviewController
|
||||||
from openlp.core.ui.slidecontroller import InfoLabel, WIDE_MENU, NON_TEXT_MENU
|
from openlp.core.ui.slidecontroller import InfoLabel, WIDE_MENU, NON_TEXT_MENU
|
||||||
|
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
|
|
||||||
|
|
||||||
class TestSlideController(TestCase):
|
class TestSlideController(TestCase):
|
||||||
|
|
||||||
|
@ -22,13 +22,11 @@
|
|||||||
"""
|
"""
|
||||||
Package to test the openlp.core.ui.themeform package.
|
Package to test the openlp.core.ui.themeform package.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from openlp.core.ui import ThemeForm
|
from openlp.core.ui import ThemeForm
|
||||||
|
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
|
|
||||||
|
|
||||||
class TestThemeManager(TestCase):
|
class TestThemeManager(TestCase):
|
||||||
"""
|
"""
|
||||||
|
@ -24,18 +24,16 @@ Package to test the openlp.core.ui.thememanager package.
|
|||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
from unittest import TestCase
|
|
||||||
from tempfile import mkdtemp
|
from tempfile import mkdtemp
|
||||||
|
from unittest import TestCase
|
||||||
|
from unittest.mock import ANY, MagicMock, patch
|
||||||
|
|
||||||
from PyQt5 import QtWidgets
|
from PyQt5 import QtWidgets
|
||||||
from tempfile import mkdtemp
|
|
||||||
|
|
||||||
from openlp.core.ui import ThemeManager
|
from openlp.core.ui import ThemeManager
|
||||||
from openlp.core.common import Registry
|
from openlp.core.common import Registry
|
||||||
|
|
||||||
from tests.utils.constants import TEST_RESOURCES_PATH
|
from tests.utils.constants import TEST_RESOURCES_PATH
|
||||||
from tests.functional import ANY, MagicMock, patch
|
|
||||||
|
|
||||||
|
|
||||||
class TestThemeManager(TestCase):
|
class TestThemeManager(TestCase):
|
||||||
|
@ -23,13 +23,13 @@
|
|||||||
Package to test the openlp.core.ui.ThemeTab package.
|
Package to test the openlp.core.ui.ThemeTab package.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock
|
||||||
|
|
||||||
from openlp.core.common import Registry
|
from openlp.core.common import Registry
|
||||||
from openlp.core.ui.themestab import ThemesTab
|
from openlp.core.ui.themestab import ThemesTab
|
||||||
from openlp.core.ui.settingsform import SettingsForm
|
from openlp.core.ui.settingsform import SettingsForm
|
||||||
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
from tests.functional import MagicMock
|
|
||||||
|
|
||||||
|
|
||||||
class TestThemeTab(TestCase, TestMixin):
|
class TestThemeTab(TestCase, TestMixin):
|
||||||
|
@ -23,9 +23,9 @@
|
|||||||
This module contains tests for the openlp.core.lib.filedialog module
|
This module contains tests for the openlp.core.lib.filedialog module
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, call, patch
|
||||||
|
|
||||||
from openlp.core.ui.lib.colorbutton import ColorButton
|
from openlp.core.ui.lib.colorbutton import ColorButton
|
||||||
from tests.functional import MagicMock, call, patch
|
|
||||||
|
|
||||||
|
|
||||||
class TestColorDialog(TestCase):
|
class TestColorDialog(TestCase):
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
Package to test the openlp.core.ui.lib.listpreviewwidget package.
|
Package to test the openlp.core.ui.lib.listpreviewwidget package.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch, call
|
||||||
|
|
||||||
from PyQt5 import QtGui
|
from PyQt5 import QtGui
|
||||||
|
|
||||||
@ -30,8 +31,6 @@ from openlp.core.common import Settings
|
|||||||
from openlp.core.ui.lib.listpreviewwidget import ListPreviewWidget
|
from openlp.core.ui.lib.listpreviewwidget import ListPreviewWidget
|
||||||
from openlp.core.lib import ImageSource, ServiceItem
|
from openlp.core.lib import ImageSource, ServiceItem
|
||||||
|
|
||||||
from tests.functional import MagicMock, patch, call
|
|
||||||
|
|
||||||
|
|
||||||
class TestListPreviewWidget(TestCase):
|
class TestListPreviewWidget(TestCase):
|
||||||
|
|
||||||
|
@ -23,12 +23,12 @@
|
|||||||
Package to test the openlp.core.ui.media package.
|
Package to test the openlp.core.ui.media package.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from openlp.core.ui.media.mediacontroller import MediaController
|
from openlp.core.ui.media.mediacontroller import MediaController
|
||||||
from openlp.core.ui.media.mediaplayer import MediaPlayer
|
from openlp.core.ui.media.mediaplayer import MediaPlayer
|
||||||
from openlp.core.common import Registry
|
from openlp.core.common import Registry
|
||||||
|
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
Package to test the openlp.core.ui.media.systemplayer package.
|
Package to test the openlp.core.ui.media.systemplayer package.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, call, patch
|
||||||
|
|
||||||
from PyQt5 import QtCore, QtMultimedia
|
from PyQt5 import QtCore, QtMultimedia
|
||||||
|
|
||||||
@ -30,8 +31,6 @@ from openlp.core.common import Registry
|
|||||||
from openlp.core.ui.media import MediaState
|
from openlp.core.ui.media import MediaState
|
||||||
from openlp.core.ui.media.systemplayer import SystemPlayer, CheckMediaWorker, ADDITIONAL_EXT
|
from openlp.core.ui.media.systemplayer import SystemPlayer, CheckMediaWorker, ADDITIONAL_EXT
|
||||||
|
|
||||||
from tests.functional import MagicMock, call, patch
|
|
||||||
|
|
||||||
|
|
||||||
class TestSystemPlayer(TestCase):
|
class TestSystemPlayer(TestCase):
|
||||||
"""
|
"""
|
||||||
|
@ -26,12 +26,12 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from unittest import TestCase, skip
|
from unittest import TestCase, skip
|
||||||
|
from unittest.mock import MagicMock, patch, call
|
||||||
|
|
||||||
from openlp.core.common import Registry
|
from openlp.core.common import Registry
|
||||||
from openlp.core.ui.media import MediaState, MediaType
|
from openlp.core.ui.media import MediaState, MediaType
|
||||||
from openlp.core.ui.media.vlcplayer import AUDIO_EXT, VIDEO_EXT, VlcPlayer, get_vlc
|
from openlp.core.ui.media.vlcplayer import AUDIO_EXT, VIDEO_EXT, VlcPlayer, get_vlc
|
||||||
|
|
||||||
from tests.functional import MagicMock, patch, call
|
|
||||||
from tests.helpers import MockDateTime
|
from tests.helpers import MockDateTime
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
Package to test the openlp.core.ui.media.webkitplayer package.
|
Package to test the openlp.core.ui.media.webkitplayer package.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
from tests.functional import MagicMock, patch
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from openlp.core.ui.media.webkitplayer import WebkitPlayer
|
from openlp.core.ui.media.webkitplayer import WebkitPlayer
|
||||||
|
|
||||||
|
@ -22,12 +22,11 @@
|
|||||||
"""
|
"""
|
||||||
This module contains tests for the CSV Bible importer.
|
This module contains tests for the CSV Bible importer.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
from openlp.core.common.registry import Registry
|
from openlp.core.common.registry import Registry
|
||||||
from openlp.plugins.alerts.lib.alertsmanager import AlertsManager
|
from openlp.plugins.alerts.lib.alertsmanager import AlertsManager
|
||||||
|
|
||||||
|
@ -22,18 +22,17 @@
|
|||||||
"""
|
"""
|
||||||
This module contains tests for the bibleimport module.
|
This module contains tests for the bibleimport module.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from lxml import etree, objectify
|
|
||||||
|
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
|
from lxml import etree, objectify
|
||||||
from PyQt5.QtWidgets import QDialog
|
from PyQt5.QtWidgets import QDialog
|
||||||
|
|
||||||
from openlp.core.common.languages import Language
|
from openlp.core.common.languages import Language
|
||||||
from openlp.core.lib.exceptions import ValidationError
|
from openlp.core.lib.exceptions import ValidationError
|
||||||
from openlp.plugins.bibles.lib.bibleimport import BibleImport
|
from openlp.plugins.bibles.lib.bibleimport import BibleImport
|
||||||
from openlp.plugins.bibles.lib.db import BibleDB
|
from openlp.plugins.bibles.lib.db import BibleDB
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
|
|
||||||
|
|
||||||
class TestBibleImport(TestCase):
|
class TestBibleImport(TestCase):
|
||||||
|
@ -23,9 +23,10 @@
|
|||||||
This module contains tests for the http module of the Bibles plugin.
|
This module contains tests for the http module of the Bibles plugin.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import patch, MagicMock
|
||||||
|
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
from tests.functional import patch, MagicMock
|
|
||||||
from openlp.plugins.bibles.lib.importers.http import BSExtract
|
from openlp.plugins.bibles.lib.importers.http import BSExtract
|
||||||
|
|
||||||
# TODO: Items left to test
|
# TODO: Items left to test
|
||||||
|
@ -22,14 +22,13 @@
|
|||||||
"""
|
"""
|
||||||
This module contains tests for the CSV Bible importer.
|
This module contains tests for the CSV Bible importer.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import csv
|
import csv
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import ANY, MagicMock, PropertyMock, call, patch
|
||||||
|
|
||||||
from tests.functional import ANY, MagicMock, PropertyMock, call, patch
|
|
||||||
from openlp.core.lib.exceptions import ValidationError
|
from openlp.core.lib.exceptions import ValidationError
|
||||||
from openlp.plugins.bibles.lib.bibleimport import BibleImport
|
from openlp.plugins.bibles.lib.bibleimport import BibleImport
|
||||||
from openlp.plugins.bibles.lib.importers.csvbible import Book, CSVBible, Verse
|
from openlp.plugins.bibles.lib.importers.csvbible import Book, CSVBible, Verse
|
||||||
|
@ -23,10 +23,11 @@
|
|||||||
This module contains tests for the lib submodule of the Bibles plugin.
|
This module contains tests for the lib submodule of the Bibles plugin.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from openlp.plugins.bibles import lib
|
from openlp.plugins.bibles import lib
|
||||||
from openlp.plugins.bibles.lib import SearchResults, get_reference_match
|
from openlp.plugins.bibles.lib import SearchResults, get_reference_match
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,19 +22,19 @@
|
|||||||
"""
|
"""
|
||||||
This module contains tests for the OpenSong Bible importer.
|
This module contains tests for the OpenSong Bible importer.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch, call
|
||||||
|
|
||||||
from lxml import objectify
|
from lxml import objectify
|
||||||
|
|
||||||
from tests.functional import MagicMock, patch, call
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
|
||||||
from openlp.core.common import Registry
|
from openlp.core.common import Registry
|
||||||
from openlp.plugins.bibles.lib.importers.opensong import OpenSongBible, get_text, parse_chapter_number
|
from openlp.plugins.bibles.lib.importers.opensong import OpenSongBible, get_text, parse_chapter_number
|
||||||
from openlp.plugins.bibles.lib.bibleimport import BibleImport
|
from openlp.plugins.bibles.lib.bibleimport import BibleImport
|
||||||
|
|
||||||
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__),
|
TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__),
|
||||||
'..', '..', '..', 'resources', 'bibles'))
|
'..', '..', '..', 'resources', 'bibles'))
|
||||||
|
|
||||||
|
@ -22,12 +22,11 @@
|
|||||||
"""
|
"""
|
||||||
This module contains tests for the OSIS Bible importer.
|
This module contains tests for the OSIS Bible importer.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, call, patch
|
||||||
|
|
||||||
from tests.functional import MagicMock, call, patch
|
|
||||||
from openlp.plugins.bibles.lib.bibleimport import BibleImport
|
from openlp.plugins.bibles.lib.bibleimport import BibleImport
|
||||||
from openlp.plugins.bibles.lib.db import BibleDB
|
from openlp.plugins.bibles.lib.db import BibleDB
|
||||||
from openlp.plugins.bibles.lib.importers.osis import OSISBible
|
from openlp.plugins.bibles.lib.importers.osis import OSISBible
|
||||||
|
@ -26,13 +26,14 @@ This module contains tests for the SWORD Bible importer.
|
|||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
from unittest import TestCase, skipUnless
|
from unittest import TestCase, skipUnless
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
try:
|
try:
|
||||||
from openlp.plugins.bibles.lib.importers.sword import SwordBible
|
from openlp.plugins.bibles.lib.importers.sword import SwordBible
|
||||||
HAS_PYSWORD = True
|
HAS_PYSWORD = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYSWORD = False
|
HAS_PYSWORD = False
|
||||||
|
|
||||||
from openlp.plugins.bibles.lib.db import BibleDB
|
from openlp.plugins.bibles.lib.db import BibleDB
|
||||||
|
|
||||||
TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__),
|
TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__),
|
||||||
|
@ -22,15 +22,12 @@
|
|||||||
"""
|
"""
|
||||||
This module contains tests for the WordProject Bible importer.
|
This module contains tests for the WordProject Bible importer.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import json
|
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch, call
|
||||||
|
|
||||||
from openlp.plugins.bibles.lib.importers.wordproject import WordProjectBible
|
from openlp.plugins.bibles.lib.importers.wordproject import WordProjectBible
|
||||||
from openlp.plugins.bibles.lib.db import BibleDB
|
|
||||||
|
|
||||||
from tests.functional import MagicMock, patch, call
|
|
||||||
|
|
||||||
TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__),
|
TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__),
|
||||||
'..', '..', '..', 'resources', 'bibles'))
|
'..', '..', '..', 'resources', 'bibles'))
|
||||||
|
@ -22,12 +22,11 @@
|
|||||||
"""
|
"""
|
||||||
This module contains tests for the Zefania Bible importer.
|
This module contains tests for the Zefania Bible importer.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
from openlp.plugins.bibles.lib.importers.zefania import ZefaniaBible
|
from openlp.plugins.bibles.lib.importers.zefania import ZefaniaBible
|
||||||
from openlp.plugins.bibles.lib.db import BibleDB
|
from openlp.plugins.bibles.lib.db import BibleDB
|
||||||
|
|
||||||
|
@ -1,15 +1,36 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
# Copyright (c) 2008-2017 OpenLP Developers #
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
# This program is free software; you can redistribute it and/or modify it #
|
||||||
|
# under the terms of the GNU General Public License as published by the Free #
|
||||||
|
# Software Foundation; version 2 of the License. #
|
||||||
|
# #
|
||||||
|
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
||||||
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
||||||
|
# more details. #
|
||||||
|
# #
|
||||||
|
# You should have received a copy of the GNU General Public License along #
|
||||||
|
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||||
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
|
###############################################################################
|
||||||
"""
|
"""
|
||||||
This module contains tests for the lib submodule of the Songs plugin.
|
This module contains tests for the lib submodule of the Songs plugin.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import patch, MagicMock
|
||||||
|
|
||||||
from PyQt5 import QtCore
|
from PyQt5 import QtCore
|
||||||
|
|
||||||
from openlp.core.common import Registry, Settings
|
from openlp.core.common import Registry
|
||||||
from openlp.core.lib import ServiceItem, PluginStatus
|
from openlp.core.lib import ServiceItem, PluginStatus
|
||||||
from openlp.plugins.custom.lib import CustomMediaItem
|
from openlp.plugins.custom.lib import CustomMediaItem
|
||||||
from openlp.plugins.custom.lib.db import CustomSlide
|
|
||||||
from tests.functional import patch, MagicMock
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
FOOTER = ['Arky Arky (Unknown)', 'Public Domain', 'CCLI 123456']
|
FOOTER = ['Arky Arky (Unknown)', 'Public Domain', 'CCLI 123456']
|
||||||
|
@ -23,15 +23,15 @@
|
|||||||
This module contains tests for the lib submodule of the Images plugin.
|
This module contains tests for the lib submodule of the Images plugin.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from PyQt5 import QtWidgets
|
from PyQt5 import QtWidgets
|
||||||
|
|
||||||
from openlp.core.common import Settings
|
from openlp.core.common import Registry, Settings
|
||||||
|
|
||||||
from openlp.core.common import Registry
|
|
||||||
from openlp.plugins.images.lib.db import ImageFilenames, ImageGroups
|
from openlp.plugins.images.lib.db import ImageFilenames, ImageGroups
|
||||||
from openlp.plugins.images.lib.mediaitem import ImageMediaItem
|
from openlp.plugins.images.lib.mediaitem import ImageMediaItem
|
||||||
from openlp.plugins.images.lib import ImageTab
|
from openlp.plugins.images.lib import ImageTab
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
__default_settings__ = {
|
__default_settings__ = {
|
||||||
|
@ -23,13 +23,13 @@
|
|||||||
This module contains tests for the lib submodule of the Images plugin.
|
This module contains tests for the lib submodule of the Images plugin.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import ANY, MagicMock, patch
|
||||||
|
|
||||||
from PyQt5 import QtCore, QtWidgets
|
from PyQt5 import QtCore, QtWidgets
|
||||||
|
|
||||||
from openlp.core.common import Registry
|
from openlp.core.common import Registry
|
||||||
from openlp.plugins.images.lib.db import ImageFilenames, ImageGroups
|
from openlp.plugins.images.lib.db import ImageFilenames, ImageGroups
|
||||||
from openlp.plugins.images.lib.mediaitem import ImageMediaItem
|
from openlp.plugins.images.lib.mediaitem import ImageMediaItem
|
||||||
from tests.functional import ANY, MagicMock, patch
|
|
||||||
|
|
||||||
|
|
||||||
class TestImageMediaItem(TestCase):
|
class TestImageMediaItem(TestCase):
|
||||||
|
@ -23,15 +23,13 @@
|
|||||||
Test the media plugin
|
Test the media plugin
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
from openlp.core import Registry, Settings
|
|
||||||
from openlp.plugins.media.mediaplugin import MediaPlugin
|
|
||||||
from openlp.plugins.media.lib.mediaitem import MediaMediaItem
|
|
||||||
from openlp.core.ui.media.mediacontroller import MediaController
|
|
||||||
|
|
||||||
from PyQt5 import QtCore
|
from PyQt5 import QtCore
|
||||||
|
|
||||||
from tests.functional import MagicMock, patch
|
from openlp.core import Settings
|
||||||
|
from openlp.plugins.media.lib.mediaitem import MediaMediaItem
|
||||||
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
__default_settings__ = {
|
__default_settings__ = {
|
||||||
|
@ -23,11 +23,11 @@
|
|||||||
Test the media plugin
|
Test the media plugin
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from openlp.core import Registry
|
from openlp.core import Registry
|
||||||
from openlp.plugins.media.mediaplugin import MediaPlugin, process_check_binary
|
from openlp.plugins.media.mediaplugin import MediaPlugin, process_check_binary
|
||||||
|
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,19 +23,19 @@
|
|||||||
Functional tests to test the Impress class and related methods.
|
Functional tests to test the Impress class and related methods.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import patch, MagicMock
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
from tempfile import mkdtemp
|
from tempfile import mkdtemp
|
||||||
|
|
||||||
from tests.functional import patch, MagicMock
|
|
||||||
from tests.utils.constants import TEST_RESOURCES_PATH
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
|
||||||
|
|
||||||
from openlp.core.common import Settings
|
from openlp.core.common import Settings
|
||||||
from openlp.plugins.presentations.lib.impresscontroller import \
|
from openlp.plugins.presentations.lib.impresscontroller import \
|
||||||
ImpressController, ImpressDocument, TextType
|
ImpressController, ImpressDocument, TextType
|
||||||
from openlp.plugins.presentations.presentationplugin import __default_settings__
|
from openlp.plugins.presentations.presentationplugin import __default_settings__
|
||||||
|
|
||||||
|
from tests.utils.constants import TEST_RESOURCES_PATH
|
||||||
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
|
|
||||||
class TestImpressController(TestCase, TestMixin):
|
class TestImpressController(TestCase, TestMixin):
|
||||||
"""
|
"""
|
||||||
|
@ -23,10 +23,11 @@
|
|||||||
This module contains tests for the lib submodule of the Presentations plugin.
|
This module contains tests for the lib submodule of the Presentations plugin.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import patch, MagicMock, call
|
||||||
|
|
||||||
from openlp.core.common import Registry
|
from openlp.core.common import Registry
|
||||||
from openlp.plugins.presentations.lib.mediaitem import PresentationMediaItem
|
from openlp.plugins.presentations.lib.mediaitem import PresentationMediaItem
|
||||||
from tests.functional import patch, MagicMock, call
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,11 +23,12 @@
|
|||||||
This module contains tests for the lib submodule of the Presentations plugin.
|
This module contains tests for the lib submodule of the Presentations plugin.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import patch, MagicMock
|
||||||
|
|
||||||
from openlp.core.common import Registry
|
from openlp.core.common import Registry
|
||||||
from openlp.plugins.presentations.lib.mediaitem import MessageListener, PresentationMediaItem
|
from openlp.plugins.presentations.lib.mediaitem import MessageListener, PresentationMediaItem
|
||||||
from openlp.plugins.presentations.lib.messagelistener import Controller
|
from openlp.plugins.presentations.lib.messagelistener import Controller
|
||||||
from tests.functional import patch, MagicMock
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,14 +24,16 @@ This module contains tests for the PdfController
|
|||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
from unittest import TestCase, SkipTest
|
|
||||||
from tempfile import mkdtemp
|
from tempfile import mkdtemp
|
||||||
|
from unittest import TestCase, SkipTest
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from PyQt5 import QtCore, QtGui
|
from PyQt5 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.plugins.presentations.lib.pdfcontroller import PdfController, PdfDocument
|
from openlp.plugins.presentations.lib.pdfcontroller import PdfController, PdfDocument
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
from openlp.core.common import Settings
|
from openlp.core.common import Settings
|
||||||
from openlp.core.lib import ScreenList
|
from openlp.core.lib import ScreenList
|
||||||
|
|
||||||
from tests.utils.constants import TEST_RESOURCES_PATH
|
from tests.utils.constants import TEST_RESOURCES_PATH
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
|
@ -1,303 +1,303 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
# --------------------------------------------------------------------------- #
|
# --------------------------------------------------------------------------- #
|
||||||
# Copyright (c) 2008-2017 OpenLP Developers #
|
# Copyright (c) 2008-2017 OpenLP Developers #
|
||||||
# --------------------------------------------------------------------------- #
|
# --------------------------------------------------------------------------- #
|
||||||
# This program is free software; you can redistribute it and/or modify it #
|
# This program is free software; you can redistribute it and/or modify it #
|
||||||
# under the terms of the GNU General Public License as published by the Free #
|
# under the terms of the GNU General Public License as published by the Free #
|
||||||
# Software Foundation; version 2 of the License. #
|
# Software Foundation; version 2 of the License. #
|
||||||
# #
|
# #
|
||||||
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
||||||
# more details. #
|
# more details. #
|
||||||
# #
|
# #
|
||||||
# You should have received a copy of the GNU General Public License along #
|
# You should have received a copy of the GNU General Public License along #
|
||||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
"""
|
"""
|
||||||
Functional tests to test the PowerPointController class and related methods.
|
Functional tests to test the PowerPointController class and related methods.
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
from tempfile import mkdtemp
|
from unittest.mock import patch, MagicMock
|
||||||
|
from tempfile import mkdtemp
|
||||||
from tests.functional import patch, MagicMock
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from openlp.plugins.presentations.lib.powerpointcontroller import PowerpointController, PowerpointDocument,\
|
||||||
from tests.utils.constants import TEST_RESOURCES_PATH
|
_get_text_from_shapes
|
||||||
|
from openlp.core.common import is_win, Settings
|
||||||
from openlp.plugins.presentations.lib.powerpointcontroller import PowerpointController, PowerpointDocument,\
|
|
||||||
_get_text_from_shapes
|
from tests.helpers.testmixin import TestMixin
|
||||||
from openlp.core.common import is_win, Settings
|
from tests.utils.constants import TEST_RESOURCES_PATH
|
||||||
|
|
||||||
if is_win():
|
if is_win():
|
||||||
import pywintypes
|
import pywintypes
|
||||||
|
|
||||||
__default_settings__ = {
|
__default_settings__ = {
|
||||||
'presentations/powerpoint slide click advance': True
|
'presentations/powerpoint slide click advance': True
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class TestPowerpointController(TestCase, TestMixin):
|
class TestPowerpointController(TestCase, TestMixin):
|
||||||
"""
|
"""
|
||||||
Test the PowerpointController Class
|
Test the PowerpointController Class
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
"""
|
"""
|
||||||
Set up the patches and mocks need for all tests.
|
Set up the patches and mocks need for all tests.
|
||||||
"""
|
"""
|
||||||
self.setup_application()
|
self.setup_application()
|
||||||
self.build_settings()
|
self.build_settings()
|
||||||
self.mock_plugin = MagicMock()
|
self.mock_plugin = MagicMock()
|
||||||
self.temp_folder = mkdtemp()
|
self.temp_folder = mkdtemp()
|
||||||
self.mock_plugin.settings_section = self.temp_folder
|
self.mock_plugin.settings_section = self.temp_folder
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
"""
|
"""
|
||||||
Stop the patches
|
Stop the patches
|
||||||
"""
|
"""
|
||||||
self.destroy_settings()
|
self.destroy_settings()
|
||||||
shutil.rmtree(self.temp_folder)
|
shutil.rmtree(self.temp_folder)
|
||||||
|
|
||||||
def test_constructor(self):
|
def test_constructor(self):
|
||||||
"""
|
"""
|
||||||
Test the Constructor from the PowerpointController
|
Test the Constructor from the PowerpointController
|
||||||
"""
|
"""
|
||||||
# GIVEN: No presentation controller
|
# GIVEN: No presentation controller
|
||||||
controller = None
|
controller = None
|
||||||
|
|
||||||
# WHEN: The presentation controller object is created
|
# WHEN: The presentation controller object is created
|
||||||
controller = PowerpointController(plugin=self.mock_plugin)
|
controller = PowerpointController(plugin=self.mock_plugin)
|
||||||
|
|
||||||
# THEN: The name of the presentation controller should be correct
|
# THEN: The name of the presentation controller should be correct
|
||||||
self.assertEqual('Powerpoint', controller.name,
|
self.assertEqual('Powerpoint', controller.name,
|
||||||
'The name of the presentation controller should be correct')
|
'The name of the presentation controller should be correct')
|
||||||
|
|
||||||
|
|
||||||
class TestPowerpointDocument(TestCase, TestMixin):
|
class TestPowerpointDocument(TestCase, TestMixin):
|
||||||
"""
|
"""
|
||||||
Test the PowerpointDocument Class
|
Test the PowerpointDocument Class
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
"""
|
"""
|
||||||
Set up the patches and mocks need for all tests.
|
Set up the patches and mocks need for all tests.
|
||||||
"""
|
"""
|
||||||
self.setup_application()
|
self.setup_application()
|
||||||
self.build_settings()
|
self.build_settings()
|
||||||
self.mock_plugin = MagicMock()
|
self.mock_plugin = MagicMock()
|
||||||
self.temp_folder = mkdtemp()
|
self.temp_folder = mkdtemp()
|
||||||
self.mock_plugin.settings_section = self.temp_folder
|
self.mock_plugin.settings_section = self.temp_folder
|
||||||
self.powerpoint_document_stop_presentation_patcher = patch(
|
self.powerpoint_document_stop_presentation_patcher = patch(
|
||||||
'openlp.plugins.presentations.lib.powerpointcontroller.PowerpointDocument.stop_presentation')
|
'openlp.plugins.presentations.lib.powerpointcontroller.PowerpointDocument.stop_presentation')
|
||||||
self.presentation_document_get_temp_folder_patcher = patch(
|
self.presentation_document_get_temp_folder_patcher = patch(
|
||||||
'openlp.plugins.presentations.lib.powerpointcontroller.PresentationDocument.get_temp_folder')
|
'openlp.plugins.presentations.lib.powerpointcontroller.PresentationDocument.get_temp_folder')
|
||||||
self.presentation_document_setup_patcher = patch(
|
self.presentation_document_setup_patcher = patch(
|
||||||
'openlp.plugins.presentations.lib.powerpointcontroller.PresentationDocument._setup')
|
'openlp.plugins.presentations.lib.powerpointcontroller.PresentationDocument._setup')
|
||||||
self.mock_powerpoint_document_stop_presentation = self.powerpoint_document_stop_presentation_patcher.start()
|
self.mock_powerpoint_document_stop_presentation = self.powerpoint_document_stop_presentation_patcher.start()
|
||||||
self.mock_presentation_document_get_temp_folder = self.presentation_document_get_temp_folder_patcher.start()
|
self.mock_presentation_document_get_temp_folder = self.presentation_document_get_temp_folder_patcher.start()
|
||||||
self.mock_presentation_document_setup = self.presentation_document_setup_patcher.start()
|
self.mock_presentation_document_setup = self.presentation_document_setup_patcher.start()
|
||||||
self.mock_controller = MagicMock()
|
self.mock_controller = MagicMock()
|
||||||
self.mock_presentation = MagicMock()
|
self.mock_presentation = MagicMock()
|
||||||
self.mock_presentation_document_get_temp_folder.return_value = 'temp folder'
|
self.mock_presentation_document_get_temp_folder.return_value = 'temp folder'
|
||||||
self.file_name = os.path.join(TEST_RESOURCES_PATH, 'presentations', 'test.pptx')
|
self.file_name = os.path.join(TEST_RESOURCES_PATH, 'presentations', 'test.pptx')
|
||||||
self.real_controller = PowerpointController(self.mock_plugin)
|
self.real_controller = PowerpointController(self.mock_plugin)
|
||||||
Settings().extend_default_settings(__default_settings__)
|
Settings().extend_default_settings(__default_settings__)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
"""
|
"""
|
||||||
Stop the patches
|
Stop the patches
|
||||||
"""
|
"""
|
||||||
self.powerpoint_document_stop_presentation_patcher.stop()
|
self.powerpoint_document_stop_presentation_patcher.stop()
|
||||||
self.presentation_document_get_temp_folder_patcher.stop()
|
self.presentation_document_get_temp_folder_patcher.stop()
|
||||||
self.presentation_document_setup_patcher.stop()
|
self.presentation_document_setup_patcher.stop()
|
||||||
self.destroy_settings()
|
self.destroy_settings()
|
||||||
shutil.rmtree(self.temp_folder)
|
shutil.rmtree(self.temp_folder)
|
||||||
|
|
||||||
def test_show_error_msg(self):
|
def test_show_error_msg(self):
|
||||||
"""
|
"""
|
||||||
Test the PowerpointDocument.show_error_msg() method gets called on com exception
|
Test the PowerpointDocument.show_error_msg() method gets called on com exception
|
||||||
"""
|
"""
|
||||||
if is_win():
|
if is_win():
|
||||||
# GIVEN: A PowerpointDocument with mocked controller and presentation
|
# GIVEN: A PowerpointDocument with mocked controller and presentation
|
||||||
with patch('openlp.plugins.presentations.lib.powerpointcontroller.critical_error_message_box') as \
|
with patch('openlp.plugins.presentations.lib.powerpointcontroller.critical_error_message_box') as \
|
||||||
mocked_critical_error_message_box:
|
mocked_critical_error_message_box:
|
||||||
instance = PowerpointDocument(self.mock_controller, self.mock_presentation)
|
instance = PowerpointDocument(self.mock_controller, self.mock_presentation)
|
||||||
instance.presentation = MagicMock()
|
instance.presentation = MagicMock()
|
||||||
instance.presentation.SlideShowWindow.View.GotoSlide = MagicMock(side_effect=pywintypes.com_error('1'))
|
instance.presentation.SlideShowWindow.View.GotoSlide = MagicMock(side_effect=pywintypes.com_error('1'))
|
||||||
instance.index_map[42] = 42
|
instance.index_map[42] = 42
|
||||||
|
|
||||||
# WHEN: Calling goto_slide which will throw an exception
|
# WHEN: Calling goto_slide which will throw an exception
|
||||||
instance.goto_slide(42)
|
instance.goto_slide(42)
|
||||||
|
|
||||||
# THEN: mocked_critical_error_message_box should have been called
|
# THEN: mocked_critical_error_message_box should have been called
|
||||||
mocked_critical_error_message_box.assert_called_with('Error', 'An error occurred in the PowerPoint '
|
mocked_critical_error_message_box.assert_called_with('Error', 'An error occurred in the PowerPoint '
|
||||||
'integration and the presentation will be stopped.'
|
'integration and the presentation will be stopped.'
|
||||||
' Restart the presentation if you wish to '
|
' Restart the presentation if you wish to '
|
||||||
'present it.')
|
'present it.')
|
||||||
|
|
||||||
# add _test to the following if necessary
|
# add _test to the following if necessary
|
||||||
def verify_loading_document(self):
|
def verify_loading_document(self):
|
||||||
"""
|
"""
|
||||||
Test loading a document in PowerPoint
|
Test loading a document in PowerPoint
|
||||||
"""
|
"""
|
||||||
if is_win() and self.real_controller.check_available():
|
if is_win() and self.real_controller.check_available():
|
||||||
# GIVEN: A PowerpointDocument and a presentation
|
# GIVEN: A PowerpointDocument and a presentation
|
||||||
doc = PowerpointDocument(self.real_controller, self.file_name)
|
doc = PowerpointDocument(self.real_controller, self.file_name)
|
||||||
|
|
||||||
# WHEN: loading the filename
|
# WHEN: loading the filename
|
||||||
doc.load_presentation()
|
doc.load_presentation()
|
||||||
result = doc.is_loaded()
|
result = doc.is_loaded()
|
||||||
|
|
||||||
# THEN: result should be true
|
# THEN: result should be true
|
||||||
self.assertEqual(result, True, 'The result should be True')
|
self.assertEqual(result, True, 'The result should be True')
|
||||||
else:
|
else:
|
||||||
self.skipTest('Powerpoint not available, skipping test.')
|
self.skipTest('Powerpoint not available, skipping test.')
|
||||||
|
|
||||||
def test_create_titles_and_notes(self):
|
def test_create_titles_and_notes(self):
|
||||||
"""
|
"""
|
||||||
Test creating the titles from PowerPoint
|
Test creating the titles from PowerPoint
|
||||||
"""
|
"""
|
||||||
# GIVEN: mocked save_titles_and_notes, _get_text_from_shapes and two mocked slides
|
# GIVEN: mocked save_titles_and_notes, _get_text_from_shapes and two mocked slides
|
||||||
self.doc = PowerpointDocument(self.mock_controller, self.file_name)
|
self.doc = PowerpointDocument(self.mock_controller, self.file_name)
|
||||||
self.doc.get_slide_count = MagicMock()
|
self.doc.get_slide_count = MagicMock()
|
||||||
self.doc.get_slide_count.return_value = 2
|
self.doc.get_slide_count.return_value = 2
|
||||||
self.doc.index_map = {1: 1, 2: 2}
|
self.doc.index_map = {1: 1, 2: 2}
|
||||||
self.doc.save_titles_and_notes = MagicMock()
|
self.doc.save_titles_and_notes = MagicMock()
|
||||||
self.doc._PowerpointDocument__get_text_from_shapes = MagicMock()
|
self.doc._PowerpointDocument__get_text_from_shapes = MagicMock()
|
||||||
slide = MagicMock()
|
slide = MagicMock()
|
||||||
slide.Shapes.Title.TextFrame.TextRange.Text = 'SlideText'
|
slide.Shapes.Title.TextFrame.TextRange.Text = 'SlideText'
|
||||||
pres = MagicMock()
|
pres = MagicMock()
|
||||||
pres.Slides = MagicMock(side_effect=[slide, slide])
|
pres.Slides = MagicMock(side_effect=[slide, slide])
|
||||||
self.doc.presentation = pres
|
self.doc.presentation = pres
|
||||||
|
|
||||||
# WHEN reading the titles and notes
|
# WHEN reading the titles and notes
|
||||||
self.doc.create_titles_and_notes()
|
self.doc.create_titles_and_notes()
|
||||||
|
|
||||||
# THEN the save should have been called exactly once with 2 titles and 2 notes
|
# THEN the save should have been called exactly once with 2 titles and 2 notes
|
||||||
self.doc.save_titles_and_notes.assert_called_once_with(['SlideText\n', 'SlideText\n'], [' ', ' '])
|
self.doc.save_titles_and_notes.assert_called_once_with(['SlideText\n', 'SlideText\n'], [' ', ' '])
|
||||||
|
|
||||||
def test_create_titles_and_notes_with_no_slides(self):
|
def test_create_titles_and_notes_with_no_slides(self):
|
||||||
"""
|
"""
|
||||||
Test creating the titles from PowerPoint when it returns no slides
|
Test creating the titles from PowerPoint when it returns no slides
|
||||||
"""
|
"""
|
||||||
# GIVEN: mocked save_titles_and_notes, _get_text_from_shapes and two mocked slides
|
# GIVEN: mocked save_titles_and_notes, _get_text_from_shapes and two mocked slides
|
||||||
doc = PowerpointDocument(self.mock_controller, self.file_name)
|
doc = PowerpointDocument(self.mock_controller, self.file_name)
|
||||||
doc.save_titles_and_notes = MagicMock()
|
doc.save_titles_and_notes = MagicMock()
|
||||||
doc._PowerpointDocument__get_text_from_shapes = MagicMock()
|
doc._PowerpointDocument__get_text_from_shapes = MagicMock()
|
||||||
pres = MagicMock()
|
pres = MagicMock()
|
||||||
pres.Slides = []
|
pres.Slides = []
|
||||||
doc.presentation = pres
|
doc.presentation = pres
|
||||||
|
|
||||||
# WHEN reading the titles and notes
|
# WHEN reading the titles and notes
|
||||||
doc.create_titles_and_notes()
|
doc.create_titles_and_notes()
|
||||||
|
|
||||||
# THEN the save should have been called exactly once with empty titles and notes
|
# THEN the save should have been called exactly once with empty titles and notes
|
||||||
doc.save_titles_and_notes.assert_called_once_with([], [])
|
doc.save_titles_and_notes.assert_called_once_with([], [])
|
||||||
|
|
||||||
def test_get_text_from_shapes(self):
|
def test_get_text_from_shapes(self):
|
||||||
"""
|
"""
|
||||||
Test getting text from powerpoint shapes
|
Test getting text from powerpoint shapes
|
||||||
"""
|
"""
|
||||||
# GIVEN: mocked shapes
|
# GIVEN: mocked shapes
|
||||||
shape = MagicMock()
|
shape = MagicMock()
|
||||||
shape.PlaceholderFormat.Type = 2
|
shape.PlaceholderFormat.Type = 2
|
||||||
shape.HasTextFrame = shape.TextFrame.HasText = True
|
shape.HasTextFrame = shape.TextFrame.HasText = True
|
||||||
shape.TextFrame.TextRange.Text = 'slideText'
|
shape.TextFrame.TextRange.Text = 'slideText'
|
||||||
shapes = [shape, shape]
|
shapes = [shape, shape]
|
||||||
|
|
||||||
# WHEN: getting the text
|
# WHEN: getting the text
|
||||||
result = _get_text_from_shapes(shapes)
|
result = _get_text_from_shapes(shapes)
|
||||||
|
|
||||||
# THEN: it should return the text
|
# THEN: it should return the text
|
||||||
self.assertEqual(result, 'slideText\nslideText\n', 'result should match \'slideText\nslideText\n\'')
|
self.assertEqual(result, 'slideText\nslideText\n', 'result should match \'slideText\nslideText\n\'')
|
||||||
|
|
||||||
def test_get_text_from_shapes_with_no_shapes(self):
|
def test_get_text_from_shapes_with_no_shapes(self):
|
||||||
"""
|
"""
|
||||||
Test getting text from powerpoint shapes with no shapes
|
Test getting text from powerpoint shapes with no shapes
|
||||||
"""
|
"""
|
||||||
# GIVEN: empty shapes array
|
# GIVEN: empty shapes array
|
||||||
shapes = []
|
shapes = []
|
||||||
|
|
||||||
# WHEN: getting the text
|
# WHEN: getting the text
|
||||||
result = _get_text_from_shapes(shapes)
|
result = _get_text_from_shapes(shapes)
|
||||||
|
|
||||||
# THEN: it should not fail but return empty string
|
# THEN: it should not fail but return empty string
|
||||||
self.assertEqual(result, '', 'result should be empty')
|
self.assertEqual(result, '', 'result should be empty')
|
||||||
|
|
||||||
def test_goto_slide(self):
|
def test_goto_slide(self):
|
||||||
"""
|
"""
|
||||||
Test that goto_slide goes to next effect if the slide is already displayed
|
Test that goto_slide goes to next effect if the slide is already displayed
|
||||||
"""
|
"""
|
||||||
# GIVEN: A Document with mocked controller, presentation, and mocked functions get_slide_number and next_step
|
# GIVEN: A Document with mocked controller, presentation, and mocked functions get_slide_number and next_step
|
||||||
doc = PowerpointDocument(self.mock_controller, self.mock_presentation)
|
doc = PowerpointDocument(self.mock_controller, self.mock_presentation)
|
||||||
doc.presentation = MagicMock()
|
doc.presentation = MagicMock()
|
||||||
doc.presentation.SlideShowWindow.View.GetClickIndex.return_value = 1
|
doc.presentation.SlideShowWindow.View.GetClickIndex.return_value = 1
|
||||||
doc.presentation.SlideShowWindow.View.GetClickCount.return_value = 2
|
doc.presentation.SlideShowWindow.View.GetClickCount.return_value = 2
|
||||||
doc.get_slide_number = MagicMock()
|
doc.get_slide_number = MagicMock()
|
||||||
doc.get_slide_number.return_value = 1
|
doc.get_slide_number.return_value = 1
|
||||||
doc.next_step = MagicMock()
|
doc.next_step = MagicMock()
|
||||||
doc.index_map[1] = 1
|
doc.index_map[1] = 1
|
||||||
|
|
||||||
# WHEN: Calling goto_slide
|
# WHEN: Calling goto_slide
|
||||||
doc.goto_slide(1)
|
doc.goto_slide(1)
|
||||||
|
|
||||||
# THEN: next_step() should be call to try to advance to the next effect.
|
# THEN: next_step() should be call to try to advance to the next effect.
|
||||||
self.assertTrue(doc.next_step.called, 'next_step() should have been called!')
|
self.assertTrue(doc.next_step.called, 'next_step() should have been called!')
|
||||||
|
|
||||||
def test_blank_screen(self):
|
def test_blank_screen(self):
|
||||||
"""
|
"""
|
||||||
Test that blank_screen works as expected
|
Test that blank_screen works as expected
|
||||||
"""
|
"""
|
||||||
# GIVEN: A Document with mocked controller, presentation, and mocked function get_slide_number
|
# GIVEN: A Document with mocked controller, presentation, and mocked function get_slide_number
|
||||||
doc = PowerpointDocument(self.mock_controller, self.mock_presentation)
|
doc = PowerpointDocument(self.mock_controller, self.mock_presentation)
|
||||||
doc.presentation = MagicMock()
|
doc.presentation = MagicMock()
|
||||||
doc.presentation.SlideShowWindow.View.GetClickIndex.return_value = 3
|
doc.presentation.SlideShowWindow.View.GetClickIndex.return_value = 3
|
||||||
doc.presentation.Application.Version = 14.0
|
doc.presentation.Application.Version = 14.0
|
||||||
doc.get_slide_number = MagicMock()
|
doc.get_slide_number = MagicMock()
|
||||||
doc.get_slide_number.return_value = 2
|
doc.get_slide_number.return_value = 2
|
||||||
|
|
||||||
# WHEN: Calling goto_slide
|
# WHEN: Calling goto_slide
|
||||||
doc.blank_screen()
|
doc.blank_screen()
|
||||||
|
|
||||||
# THEN: The view state, doc.blank_slide and doc.blank_click should have new values
|
# THEN: The view state, doc.blank_slide and doc.blank_click should have new values
|
||||||
self.assertEquals(doc.presentation.SlideShowWindow.View.State, 3, 'The View State should be 3')
|
self.assertEquals(doc.presentation.SlideShowWindow.View.State, 3, 'The View State should be 3')
|
||||||
self.assertEquals(doc.blank_slide, 2, 'doc.blank_slide should be 2 because of the PowerPoint version')
|
self.assertEquals(doc.blank_slide, 2, 'doc.blank_slide should be 2 because of the PowerPoint version')
|
||||||
self.assertEquals(doc.blank_click, 3, 'doc.blank_click should be 3 because of the PowerPoint version')
|
self.assertEquals(doc.blank_click, 3, 'doc.blank_click should be 3 because of the PowerPoint version')
|
||||||
|
|
||||||
def test_unblank_screen(self):
|
def test_unblank_screen(self):
|
||||||
"""
|
"""
|
||||||
Test that unblank_screen works as expected
|
Test that unblank_screen works as expected
|
||||||
"""
|
"""
|
||||||
# GIVEN: A Document with mocked controller, presentation, ScreenList, and mocked function get_slide_number
|
# GIVEN: A Document with mocked controller, presentation, ScreenList, and mocked function get_slide_number
|
||||||
with patch('openlp.plugins.presentations.lib.powerpointcontroller.ScreenList') as mocked_screen_list:
|
with patch('openlp.plugins.presentations.lib.powerpointcontroller.ScreenList') as mocked_screen_list:
|
||||||
mocked_screen_list_ret = MagicMock()
|
mocked_screen_list_ret = MagicMock()
|
||||||
mocked_screen_list_ret.screen_list = [1]
|
mocked_screen_list_ret.screen_list = [1]
|
||||||
mocked_screen_list.return_value = mocked_screen_list_ret
|
mocked_screen_list.return_value = mocked_screen_list_ret
|
||||||
doc = PowerpointDocument(self.mock_controller, self.mock_presentation)
|
doc = PowerpointDocument(self.mock_controller, self.mock_presentation)
|
||||||
doc.presentation = MagicMock()
|
doc.presentation = MagicMock()
|
||||||
doc.presentation.SlideShowWindow.View.GetClickIndex.return_value = 3
|
doc.presentation.SlideShowWindow.View.GetClickIndex.return_value = 3
|
||||||
doc.presentation.Application.Version = 14.0
|
doc.presentation.Application.Version = 14.0
|
||||||
doc.get_slide_number = MagicMock()
|
doc.get_slide_number = MagicMock()
|
||||||
doc.get_slide_number.return_value = 2
|
doc.get_slide_number.return_value = 2
|
||||||
doc.index_map[1] = 1
|
doc.index_map[1] = 1
|
||||||
doc.blank_slide = 1
|
doc.blank_slide = 1
|
||||||
doc.blank_click = 1
|
doc.blank_click = 1
|
||||||
|
|
||||||
# WHEN: Calling goto_slide
|
# WHEN: Calling goto_slide
|
||||||
doc.unblank_screen()
|
doc.unblank_screen()
|
||||||
|
|
||||||
# THEN: The view state have new value, and several function should have been called
|
# THEN: The view state have new value, and several function should have been called
|
||||||
self.assertEquals(doc.presentation.SlideShowWindow.View.State, 1, 'The View State should be 1')
|
self.assertEquals(doc.presentation.SlideShowWindow.View.State, 1, 'The View State should be 1')
|
||||||
self.assertEquals(doc.presentation.SlideShowWindow.Activate.called, True,
|
self.assertEquals(doc.presentation.SlideShowWindow.Activate.called, True,
|
||||||
'SlideShowWindow.Activate should have been called')
|
'SlideShowWindow.Activate should have been called')
|
||||||
self.assertEquals(doc.presentation.SlideShowWindow.View.GotoSlide.called, True,
|
self.assertEquals(doc.presentation.SlideShowWindow.View.GotoSlide.called, True,
|
||||||
'View.GotoSlide should have been called because of the PowerPoint version')
|
'View.GotoSlide should have been called because of the PowerPoint version')
|
||||||
self.assertEquals(doc.presentation.SlideShowWindow.View.GotoClick.called, True,
|
self.assertEquals(doc.presentation.SlideShowWindow.View.GotoClick.called, True,
|
||||||
'View.GotoClick should have been called because of the PowerPoint version')
|
'View.GotoClick should have been called because of the PowerPoint version')
|
||||||
|
@ -24,17 +24,16 @@ This module contains tests for the pptviewcontroller module of the Presentations
|
|||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
from tempfile import mkdtemp
|
from tempfile import mkdtemp
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
|
||||||
from tests.utils.constants import TEST_RESOURCES_PATH
|
|
||||||
|
|
||||||
from openlp.plugins.presentations.lib.pptviewcontroller import PptviewDocument, PptviewController
|
from openlp.plugins.presentations.lib.pptviewcontroller import PptviewDocument, PptviewController
|
||||||
from openlp.core.common import is_win
|
from openlp.core.common import is_win
|
||||||
|
|
||||||
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
from tests.utils.constants import TEST_RESOURCES_PATH
|
||||||
|
|
||||||
if is_win():
|
if is_win():
|
||||||
from ctypes import cdll
|
from ctypes import cdll
|
||||||
|
|
||||||
|
@ -23,10 +23,11 @@
|
|||||||
Functional tests to test the PresentationController and PresentationDocument
|
Functional tests to test the PresentationController and PresentationDocument
|
||||||
classes and related methods.
|
classes and related methods.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
|
||||||
import os
|
import os
|
||||||
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, mock_open, patch
|
||||||
|
|
||||||
from openlp.plugins.presentations.lib.presentationcontroller import PresentationController, PresentationDocument
|
from openlp.plugins.presentations.lib.presentationcontroller import PresentationController, PresentationDocument
|
||||||
from tests.functional import MagicMock, mock_open, patch
|
|
||||||
|
|
||||||
FOLDER_TO_PATCH = 'openlp.plugins.presentations.lib.presentationcontroller.PresentationDocument.get_thumbnail_folder'
|
FOLDER_TO_PATCH = 'openlp.plugins.presentations.lib.presentationcontroller.PresentationDocument.get_thumbnail_folder'
|
||||||
|
|
||||||
|
@ -25,13 +25,13 @@ This module contains tests for the lib submodule of the Remotes plugin.
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
from PyQt5 import QtWidgets
|
from PyQt5 import QtWidgets
|
||||||
|
|
||||||
|
|
||||||
from openlp.core.common import Settings
|
from openlp.core.common import Settings
|
||||||
from openlp.plugins.remotes.lib.remotetab import RemoteTab
|
from openlp.plugins.remotes.lib.remotetab import RemoteTab
|
||||||
from tests.functional import patch
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
__default_settings__ = {
|
__default_settings__ = {
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
This module contains tests for the lib submodule of the Songs plugin.
|
This module contains tests for the lib submodule of the Songs plugin.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import patch, MagicMock
|
||||||
|
|
||||||
from PyQt5 import QtCore
|
from PyQt5 import QtCore
|
||||||
|
|
||||||
@ -30,7 +31,7 @@ from openlp.core.common import Registry, Settings
|
|||||||
from openlp.core.lib import ServiceItem
|
from openlp.core.lib import ServiceItem
|
||||||
from openlp.plugins.songs.forms.editsongform import EditSongForm
|
from openlp.plugins.songs.forms.editsongform import EditSongForm
|
||||||
from openlp.plugins.songs.lib.db import AuthorType
|
from openlp.plugins.songs.lib.db import AuthorType
|
||||||
from tests.functional import patch, MagicMock
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,14 +23,12 @@
|
|||||||
This module contains tests for the editverseform of the Songs plugin.
|
This module contains tests for the editverseform of the Songs plugin.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock
|
||||||
|
|
||||||
from PyQt5 import QtCore, QtWidgets
|
from PyQt5 import QtCore
|
||||||
|
|
||||||
from openlp.core.common import Registry, Settings
|
|
||||||
from openlp.core.lib import ServiceItem
|
|
||||||
from openlp.plugins.songs.forms.editverseform import EditVerseForm
|
from openlp.plugins.songs.forms.editverseform import EditVerseForm
|
||||||
from openlp.plugins.songs.lib.db import AuthorType
|
|
||||||
from tests.functional import patch, MagicMock
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,11 +22,9 @@
|
|||||||
"""
|
"""
|
||||||
This module contains tests for the EasyWorship song importer.
|
This module contains tests for the EasyWorship song importer.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
|
|
||||||
from openlp.core.common import Registry
|
from openlp.core.common import Registry
|
||||||
from openlp.plugins.songs.lib.importers.easyworship import EasyWorshipSongImport, FieldDescEntry, FieldType
|
from openlp.plugins.songs.lib.importers.easyworship import EasyWorshipSongImport, FieldDescEntry, FieldType
|
||||||
|
@ -22,10 +22,9 @@
|
|||||||
"""
|
"""
|
||||||
This module contains tests for the SongShow Plus song importer.
|
This module contains tests for the SongShow Plus song importer.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
from tests.functional import patch, MagicMock
|
from unittest.mock import patch, MagicMock
|
||||||
|
|
||||||
from openlp.plugins.songs.lib.importers.foilpresenter import FoilPresenter
|
from openlp.plugins.songs.lib.importers.foilpresenter import FoilPresenter
|
||||||
|
|
||||||
|
@ -23,10 +23,10 @@
|
|||||||
This module contains tests for the lib submodule of the Songs plugin.
|
This module contains tests for the lib submodule of the Songs plugin.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import patch, MagicMock, PropertyMock
|
||||||
|
|
||||||
from openlp.plugins.songs.lib import VerseType, clean_string, clean_title, strip_rtf
|
from openlp.plugins.songs.lib import VerseType, clean_string, clean_title, strip_rtf
|
||||||
from openlp.plugins.songs.lib.songcompare import songs_probably_equal, _remove_typos, _op_length
|
from openlp.plugins.songs.lib.songcompare import songs_probably_equal, _remove_typos, _op_length
|
||||||
from tests.functional import patch, MagicMock, PropertyMock
|
|
||||||
|
|
||||||
|
|
||||||
class TestLib(TestCase):
|
class TestLib(TestCase):
|
||||||
|
@ -21,14 +21,10 @@
|
|||||||
"""
|
"""
|
||||||
This module contains tests for the LyriX song importer.
|
This module contains tests for the LyriX song importer.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from unittest import TestCase
|
from unittest.mock import patch
|
||||||
|
|
||||||
from tests.helpers.songfileimport import SongImportTestHelper
|
from tests.helpers.songfileimport import SongImportTestHelper
|
||||||
from openlp.plugins.songs.lib.importers.opensong import OpenSongImport
|
|
||||||
from openlp.core.common import Registry
|
|
||||||
from tests.functional import patch, MagicMock
|
|
||||||
|
|
||||||
TEST_PATH = os.path.abspath(
|
TEST_PATH = os.path.abspath(
|
||||||
os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources', 'lyrixsongs'))
|
os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources', 'lyrixsongs'))
|
||||||
|
@ -23,15 +23,15 @@
|
|||||||
This module contains tests for the lib submodule of the Songs plugin.
|
This module contains tests for the lib submodule of the Songs plugin.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
from unittest.mock import call
|
from unittest.mock import MagicMock, patch, call
|
||||||
|
|
||||||
from PyQt5 import QtCore
|
from PyQt5 import QtCore
|
||||||
|
|
||||||
from openlp.core.common import Registry, Settings
|
from openlp.core.common import Registry, Settings
|
||||||
from openlp.core.lib import ServiceItem
|
from openlp.core.lib import ServiceItem
|
||||||
from openlp.plugins.songs.lib.mediaitem import SongMediaItem
|
|
||||||
from openlp.plugins.songs.lib.db import AuthorType, Song
|
from openlp.plugins.songs.lib.db import AuthorType, Song
|
||||||
from tests.functional import patch, MagicMock
|
from openlp.plugins.songs.lib.mediaitem import SongMediaItem
|
||||||
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,8 +22,9 @@
|
|||||||
"""
|
"""
|
||||||
Test the MediaShout importer
|
Test the MediaShout importer
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase, skipUnless
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
from unittest import TestCase, skipUnless
|
||||||
|
from unittest.mock import MagicMock, patch, call
|
||||||
|
|
||||||
from openlp.core.common import Registry
|
from openlp.core.common import Registry
|
||||||
try:
|
try:
|
||||||
@ -32,8 +33,6 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
CAN_RUN_TESTS = False
|
CAN_RUN_TESTS = False
|
||||||
|
|
||||||
from tests.functional import MagicMock, patch, call
|
|
||||||
|
|
||||||
|
|
||||||
@skipUnless(CAN_RUN_TESTS, 'Not Windows, skipping test')
|
@skipUnless(CAN_RUN_TESTS, 'Not Windows, skipping test')
|
||||||
class TestMediaShoutImport(TestCase):
|
class TestMediaShoutImport(TestCase):
|
||||||
|
@ -23,10 +23,10 @@
|
|||||||
This module contains tests for the OpenLP song importer.
|
This module contains tests for the OpenLP song importer.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import patch, MagicMock
|
||||||
|
|
||||||
from openlp.plugins.songs.lib.importers.openlp import OpenLPSongImport
|
|
||||||
from openlp.core.common import Registry
|
from openlp.core.common import Registry
|
||||||
from tests.functional import patch, MagicMock
|
from openlp.plugins.songs.lib.importers.openlp import OpenLPSongImport
|
||||||
|
|
||||||
|
|
||||||
class TestOpenLPImport(TestCase):
|
class TestOpenLPImport(TestCase):
|
||||||
|
@ -22,17 +22,17 @@
|
|||||||
"""
|
"""
|
||||||
This module contains tests for the OpenLyrics song importer.
|
This module contains tests for the OpenLyrics song importer.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
from unittest import TestCase
|
|
||||||
from tempfile import mkdtemp
|
from tempfile import mkdtemp
|
||||||
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
|
||||||
from openlp.plugins.songs.lib.openlyricsexport import OpenLyricsExport
|
from openlp.plugins.songs.lib.openlyricsexport import OpenLyricsExport
|
||||||
from openlp.core.common import Registry
|
from openlp.core.common import Registry
|
||||||
|
|
||||||
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
|
|
||||||
class TestOpenLyricsExport(TestCase, TestMixin):
|
class TestOpenLyricsExport(TestCase, TestMixin):
|
||||||
"""
|
"""
|
||||||
|
@ -22,19 +22,19 @@
|
|||||||
"""
|
"""
|
||||||
This module contains tests for the OpenLyrics song importer.
|
This module contains tests for the OpenLyrics song importer.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from lxml import etree, objectify
|
from lxml import etree, objectify
|
||||||
|
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
|
||||||
from openlp.plugins.songs.lib.importers.openlyrics import OpenLyricsImport
|
from openlp.plugins.songs.lib.importers.openlyrics import OpenLyricsImport
|
||||||
from openlp.plugins.songs.lib.importers.songimport import SongImport
|
from openlp.plugins.songs.lib.importers.songimport import SongImport
|
||||||
from openlp.plugins.songs.lib.openlyricsxml import OpenLyrics
|
from openlp.plugins.songs.lib.openlyricsxml import OpenLyrics
|
||||||
from openlp.core.common import Registry, Settings
|
from openlp.core.common import Registry, Settings
|
||||||
|
|
||||||
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__),
|
TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__),
|
||||||
'..', '..', '..', 'resources', 'openlyricssongs'))
|
'..', '..', '..', 'resources', 'openlyricssongs'))
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
This module contains tests for the OpenOffice/LibreOffice importer.
|
This module contains tests for the OpenOffice/LibreOffice importer.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase, SkipTest
|
from unittest import TestCase, SkipTest
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from openlp.core.common import Registry
|
from openlp.core.common import Registry
|
||||||
try:
|
try:
|
||||||
@ -30,7 +31,6 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
raise SkipTest('Could not import OpenOfficeImport probably due to unavailability of uno')
|
raise SkipTest('Could not import OpenOfficeImport probably due to unavailability of uno')
|
||||||
|
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,12 +24,12 @@ This module contains tests for the OpenSong song importer.
|
|||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import patch, MagicMock
|
||||||
|
|
||||||
from openlp.plugins.songs.lib.importers.opensong import OpenSongImport
|
|
||||||
from openlp.core.common import Registry
|
from openlp.core.common import Registry
|
||||||
|
from openlp.plugins.songs.lib.importers.opensong import OpenSongImport
|
||||||
|
|
||||||
from tests.helpers.songfileimport import SongImportTestHelper
|
from tests.helpers.songfileimport import SongImportTestHelper
|
||||||
from tests.functional import patch, MagicMock
|
|
||||||
|
|
||||||
TEST_PATH = os.path.abspath(
|
TEST_PATH = os.path.abspath(
|
||||||
os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources', 'opensongsongs'))
|
os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources', 'opensongsongs'))
|
||||||
|
@ -25,6 +25,7 @@ This module contains tests for the WorshipCenter Pro song importer.
|
|||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
from unittest import TestCase, skipUnless
|
from unittest import TestCase, skipUnless
|
||||||
|
from unittest.mock import patch, MagicMock
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from openlp.core.common import Registry
|
from openlp.core.common import Registry
|
||||||
@ -33,8 +34,6 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
CAN_RUN_TESTS = False
|
CAN_RUN_TESTS = False
|
||||||
|
|
||||||
from tests.functional import patch, MagicMock
|
|
||||||
|
|
||||||
TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources', 'opsprosongs'))
|
TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources', 'opsprosongs'))
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,15 +22,15 @@
|
|||||||
"""
|
"""
|
||||||
This module contains tests for the Songbeamer song importer.
|
This module contains tests for the Songbeamer song importer.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from tests.helpers.songfileimport import SongImportTestHelper
|
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
from openlp.plugins.songs.lib.importers.songbeamer import SongBeamerImport, SongBeamerTypes
|
from openlp.plugins.songs.lib.importers.songbeamer import SongBeamerImport, SongBeamerTypes
|
||||||
from openlp.core.common import Registry
|
from openlp.core.common import Registry
|
||||||
|
|
||||||
|
from tests.helpers.songfileimport import SongImportTestHelper
|
||||||
|
|
||||||
TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__),
|
TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__),
|
||||||
'..', '..', '..', 'resources', 'songbeamersongs'))
|
'..', '..', '..', 'resources', 'songbeamersongs'))
|
||||||
|
|
||||||
|
@ -22,14 +22,14 @@
|
|||||||
"""
|
"""
|
||||||
This module contains tests for the SongShow Plus song importer.
|
This module contains tests for the SongShow Plus song importer.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import patch, MagicMock
|
||||||
|
|
||||||
from tests.helpers.songfileimport import SongImportTestHelper
|
|
||||||
from openlp.plugins.songs.lib import VerseType
|
from openlp.plugins.songs.lib import VerseType
|
||||||
from openlp.plugins.songs.lib.importers.songshowplus import SongShowPlusImport
|
from openlp.plugins.songs.lib.importers.songshowplus import SongShowPlusImport
|
||||||
from tests.functional import patch, MagicMock
|
|
||||||
|
from tests.helpers.songfileimport import SongImportTestHelper
|
||||||
|
|
||||||
TEST_PATH = os.path.abspath(
|
TEST_PATH = os.path.abspath(
|
||||||
os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources', 'songshowplussongs'))
|
os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources', 'songshowplussongs'))
|
||||||
|
@ -19,13 +19,12 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
"""
|
"""
|
||||||
This module contains tests for the VideoPsalm song importer.
|
This module contains tests for the SundayPlus song importer.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
from tests.helpers.songfileimport import SongImportTestHelper
|
from tests.helpers.songfileimport import SongImportTestHelper
|
||||||
from tests.functional import patch
|
|
||||||
|
|
||||||
TEST_PATH = os.path.abspath(
|
TEST_PATH = os.path.abspath(
|
||||||
os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources', 'sundayplussongs'))
|
os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources', 'sundayplussongs'))
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
This module contains tests for the WorshipCenter Pro song importer.
|
This module contains tests for the WorshipCenter Pro song importer.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase, skipUnless
|
from unittest import TestCase, skipUnless
|
||||||
|
from unittest.mock import patch, MagicMock
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import pyodbc
|
import pyodbc
|
||||||
@ -33,9 +34,6 @@ except ImportError:
|
|||||||
CAN_RUN_TESTS = False
|
CAN_RUN_TESTS = False
|
||||||
|
|
||||||
|
|
||||||
from tests.functional import patch, MagicMock
|
|
||||||
|
|
||||||
|
|
||||||
class TestRecord(object):
|
class TestRecord(object):
|
||||||
"""
|
"""
|
||||||
Microsoft Access Driver is not available on non Microsoft Systems for this reason the :class:`TestRecord` is used
|
Microsoft Access Driver is not available on non Microsoft Systems for this reason the :class:`TestRecord` is used
|
||||||
|
@ -23,15 +23,15 @@
|
|||||||
This module contains tests for the ZionWorx song importer.
|
This module contains tests for the ZionWorx song importer.
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from tests.functional import MagicMock, patch
|
|
||||||
from tests.helpers.songfileimport import SongImportTestHelper
|
|
||||||
from openlp.plugins.songs.lib.importers.zionworx import ZionWorxImport
|
from openlp.plugins.songs.lib.importers.zionworx import ZionWorxImport
|
||||||
from openlp.plugins.songs.lib.importers.songimport import SongImport
|
from openlp.plugins.songs.lib.importers.songimport import SongImport
|
||||||
from openlp.core.common import Registry
|
from openlp.core.common import Registry
|
||||||
|
|
||||||
|
from tests.helpers.songfileimport import SongImportTestHelper
|
||||||
|
|
||||||
TEST_PATH = os.path.abspath(
|
TEST_PATH = os.path.abspath(
|
||||||
os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources', 'zionworxsongs'))
|
os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources', 'zionworxsongs'))
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ Package to test the openlp.core.__init__ package.
|
|||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch, call
|
||||||
|
|
||||||
from PyQt5 import QtCore, QtWidgets
|
from PyQt5 import QtCore, QtWidgets
|
||||||
|
|
||||||
@ -31,7 +32,6 @@ from openlp.core import OpenLP, parse_options
|
|||||||
from openlp.core.common import Settings
|
from openlp.core.common import Settings
|
||||||
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
from tests.functional import MagicMock, patch, call
|
|
||||||
|
|
||||||
TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'resources'))
|
TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'resources'))
|
||||||
|
|
||||||
|
@ -26,11 +26,10 @@ song files from third party applications.
|
|||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch, call
|
||||||
|
|
||||||
from openlp.plugins.songs.lib.importers.opensong import OpenSongImport
|
|
||||||
from openlp.core.common import Registry
|
from openlp.core.common import Registry
|
||||||
|
from openlp.plugins.songs.lib.importers.opensong import OpenSongImport
|
||||||
from tests.functional import patch, MagicMock, call
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -19,9 +19,6 @@
|
|||||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
import sys
|
"""
|
||||||
|
Interface tests
|
||||||
if sys.version_info[1] >= 3:
|
"""
|
||||||
from unittest.mock import patch, MagicMock
|
|
||||||
else:
|
|
||||||
from mock import patch, MagicMock
|
|
||||||
|
@ -27,12 +27,13 @@ import shutil
|
|||||||
import gc
|
import gc
|
||||||
from tempfile import mkdtemp
|
from tempfile import mkdtemp
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from PyQt5 import QtWidgets
|
from PyQt5 import QtWidgets
|
||||||
|
|
||||||
from openlp.core.common import Registry, Settings
|
from openlp.core.common import Registry, Settings
|
||||||
from openlp.core.lib.pluginmanager import PluginManager
|
from openlp.core.lib.pluginmanager import PluginManager
|
||||||
from tests.interfaces import MagicMock, patch
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,12 +23,13 @@
|
|||||||
Package to test the openlp.core.ui package.
|
Package to test the openlp.core.ui package.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from PyQt5 import QtTest, QtWidgets
|
from PyQt5 import QtTest, QtWidgets
|
||||||
|
|
||||||
from openlp.core.common import Registry
|
from openlp.core.common import Registry
|
||||||
from openlp.core.ui import filerenameform
|
from openlp.core.ui import filerenameform
|
||||||
from tests.interfaces import MagicMock, patch
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,11 +23,11 @@
|
|||||||
Package to test the openlp.core.ui.mainwindow package.
|
Package to test the openlp.core.ui.mainwindow package.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from openlp.core.common import Registry
|
from openlp.core.common import Registry
|
||||||
from openlp.core.ui.mainwindow import MainWindow
|
from openlp.core.ui.mainwindow import MainWindow
|
||||||
from tests.interfaces import MagicMock, patch
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,12 +25,12 @@ class and methods.
|
|||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
from openlp.core.common import Registry
|
from openlp.core.common import Registry
|
||||||
from openlp.core.lib.projector.db import Projector, ProjectorDB
|
from openlp.core.lib.projector.db import Projector, ProjectorDB
|
||||||
from openlp.core.ui import ProjectorEditForm
|
from openlp.core.ui import ProjectorEditForm
|
||||||
|
|
||||||
from tests.functional import patch
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
from tests.resources.projector.data import TEST_DB, TEST1_DATA, TEST2_DATA
|
from tests.resources.projector.data import TEST_DB, TEST1_DATA, TEST2_DATA
|
||||||
|
|
||||||
|
@ -24,14 +24,13 @@ Interface tests to test the themeManager class and related methods.
|
|||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import patch, MagicMock
|
||||||
|
|
||||||
from openlp.core.common import Registry, Settings
|
from openlp.core.common import Registry, Settings
|
||||||
from tests.functional import patch, MagicMock
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
|
||||||
|
|
||||||
from openlp.core.ui import ProjectorManager, ProjectorEditForm
|
from openlp.core.ui import ProjectorManager, ProjectorEditForm
|
||||||
from openlp.core.lib.projector.db import Projector, ProjectorDB
|
from openlp.core.lib.projector.db import Projector, ProjectorDB
|
||||||
|
|
||||||
|
from tests.helpers.testmixin import TestMixin
|
||||||
from tests.resources.projector.data import TEST_DB, TEST1_DATA, TEST2_DATA, TEST3_DATA
|
from tests.resources.projector.data import TEST_DB, TEST1_DATA, TEST2_DATA, TEST3_DATA
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,24 +24,21 @@
|
|||||||
|
|
||||||
Tests for the Projector Source Select form.
|
Tests for the Projector Source Select form.
|
||||||
"""
|
"""
|
||||||
import logging
|
|
||||||
log = logging.getLogger(__name__)
|
|
||||||
log.debug('test_projectorsourceform loaded')
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
from PyQt5.QtWidgets import QDialog
|
from PyQt5.QtWidgets import QDialog
|
||||||
|
|
||||||
from tests.functional import patch
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
|
||||||
from tests.resources.projector.data import TEST_DB, TEST1_DATA
|
|
||||||
|
|
||||||
from openlp.core.common import Registry, Settings
|
from openlp.core.common import Registry, Settings
|
||||||
from openlp.core.lib.projector.db import ProjectorDB, Projector
|
from openlp.core.lib.projector.db import ProjectorDB, Projector
|
||||||
from openlp.core.lib.projector.constants import PJLINK_DEFAULT_CODES, PJLINK_DEFAULT_SOURCES
|
from openlp.core.lib.projector.constants import PJLINK_DEFAULT_CODES, PJLINK_DEFAULT_SOURCES
|
||||||
from openlp.core.ui.projector.sourceselectform import source_group, SourceSelectSingle
|
from openlp.core.ui.projector.sourceselectform import source_group, SourceSelectSingle
|
||||||
|
|
||||||
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
from tests.resources.projector.data import TEST_DB, TEST1_DATA
|
||||||
|
|
||||||
|
|
||||||
def build_source_dict():
|
def build_source_dict():
|
||||||
"""
|
"""
|
||||||
|
@ -22,13 +22,13 @@
|
|||||||
"""
|
"""
|
||||||
Package to test the openlp.core.lib package.
|
Package to test the openlp.core.lib package.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from openlp.core.common import Registry
|
from openlp.core.common import Registry
|
||||||
from openlp.core.lib import ScreenList, ServiceItem, ItemCapabilities
|
from openlp.core.lib import ScreenList, ServiceItem, ItemCapabilities
|
||||||
from openlp.core.ui.mainwindow import MainWindow
|
from openlp.core.ui.mainwindow import MainWindow
|
||||||
from tests.interfaces import MagicMock, patch
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,12 +23,13 @@
|
|||||||
Package to test the openlp.core.ui package.
|
Package to test the openlp.core.ui package.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
from PyQt5 import QtCore, QtTest, QtWidgets
|
from PyQt5 import QtCore, QtTest, QtWidgets
|
||||||
|
|
||||||
from openlp.core.common import Registry
|
from openlp.core.common import Registry
|
||||||
from openlp.core.ui import servicenoteform
|
from openlp.core.ui import servicenoteform
|
||||||
from tests.interfaces import patch
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,13 +23,14 @@
|
|||||||
Package to test the openlp.core.lib.settingsform package.
|
Package to test the openlp.core.lib.settingsform package.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from PyQt5 import QtCore, QtTest
|
from PyQt5 import QtCore, QtTest
|
||||||
|
|
||||||
from openlp.core.common import Registry
|
from openlp.core.common import Registry
|
||||||
from openlp.core.ui import settingsform
|
from openlp.core.ui import settingsform
|
||||||
from openlp.core.lib import ScreenList
|
from openlp.core.lib import ScreenList
|
||||||
from tests.interfaces import MagicMock, patch
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
|
|
||||||
SCREEN = {
|
SCREEN = {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user