This commit is contained in:
Tim Bentley 2017-12-28 08:22:55 +00:00
parent 5495ba8cf3
commit f9e20e2108
63 changed files with 27 additions and 85 deletions

View File

@ -22,7 +22,6 @@
"""
Base directory for tests
"""
import sys
from PyQt5 import QtWidgets
# Only one QApplication can be created. Use QtWidgets.QApplication.instance() when you need to "create" a QApplication.

View File

@ -28,9 +28,9 @@ from unittest.mock import patch
from PyQt5 import QtWidgets
from openlp.core.api.tab import ApiTab
from openlp.core.common.registry import Registry
from openlp.core.common.settings import Settings
from openlp.core.api.tab import ApiTab
from tests.helpers.testmixin import TestMixin
__default_settings__ = {

View File

@ -25,10 +25,10 @@ Functional tests to test the Http Server Class.
from unittest import TestCase
from unittest.mock import MagicMock, patch
from openlp.core.api.poll import Poller
from openlp.core.api.websockets import WebSocketServer
from openlp.core.common.registry import Registry
from openlp.core.common.settings import Settings
from openlp.core.api.websockets import WebSocketServer
from openlp.core.api.poll import Poller
from tests.helpers.testmixin import TestMixin
__default_settings__ = {

View File

@ -29,7 +29,6 @@ from PyQt5 import QtGui, QtCore, QtWidgets
from openlp.core.common.actions import CategoryActionList, ActionList
from openlp.core.common.settings import Settings
from tests.helpers.testmixin import TestMixin

View File

@ -29,7 +29,6 @@ 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.path import Path
from tests.helpers.testmixin import TestMixin

View File

@ -22,15 +22,13 @@
"""
Functional tests to test the AppLocation class and related methods.
"""
import os
from io import BytesIO
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
from openlp.core.common.path import Path
from tests.helpers.testmixin import TestMixin

View File

@ -26,8 +26,8 @@ import json
from unittest import TestCase
from unittest.mock import patch
from openlp.core.common.path import Path
from openlp.core.common.json import OpenLPJsonDecoder, OpenLPJsonEncoder
from openlp.core.common.path import Path
class TestOpenLPJsonDecoder(TestCase):

View File

@ -26,7 +26,6 @@ Package to test the openlp.core.ui.projector.networkutils package.
from unittest import TestCase
from openlp.core.common import verify_ip_address, md5_hash, qmd5_hash
from tests.resources.projector.data import TEST_PIN, TEST_SALT, TEST_HASH
salt = TEST_SALT

View File

@ -28,7 +28,6 @@ from unittest.mock import call, patch
from openlp.core.common import settings
from openlp.core.common.settings import Settings, media_players_conv
from tests.helpers.testmixin import TestMixin

View File

@ -28,12 +28,11 @@ from unittest.mock import MagicMock, patch
from PyQt5 import QtCore
from openlp.core.common.registry import Registry
from openlp.core.display.screens import ScreenList
from openlp.core.display.renderer import Renderer, words_split, get_start_tags
from openlp.core.display.screens import ScreenList
from openlp.core.lib import ServiceItem
from openlp.core.lib.theme import Theme
SCREEN = {
'primary': False,
'number': 1,

View File

@ -23,14 +23,13 @@
Package to test the openlp.core.lib package.
"""
import shutil
from tempfile import mkdtemp
from unittest import TestCase
from unittest.mock import patch, MagicMock
from sqlalchemy.pool import NullPool
from sqlalchemy.orm.scoping import ScopedSession
from sqlalchemy import MetaData
from sqlalchemy.orm.scoping import ScopedSession
from sqlalchemy.pool import NullPool
from openlp.core.common.path import Path
from openlp.core.lib.db import init_db, get_upgrade_op, delete_database, upgrade_db

View File

@ -10,7 +10,6 @@ from openlp.core.common.settings import Settings
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_chords_css
from openlp.core.lib.theme import HorizontalType, VerticalType
from tests.helpers.testmixin import TestMixin
HTML = """

View File

@ -33,7 +33,6 @@ from PyQt5 import QtGui
from openlp.core.common.registry import Registry
from openlp.core.display.screens import ScreenList
from openlp.core.lib.imagemanager import ImageManager, Priority
from tests.helpers.testmixin import TestMixin
from tests.utils.constants import RESOURCE_PATH

View File

@ -26,7 +26,6 @@ from unittest import TestCase
from unittest.mock import MagicMock, patch
from openlp.core.lib import MediaManagerItem
from tests.helpers.testmixin import TestMixin

View File

@ -27,8 +27,8 @@ from unittest.mock import MagicMock
from openlp.core.common.registry import Registry
from openlp.core.common.settings import Settings
from openlp.core.lib.pluginmanager import PluginManager
from openlp.core.lib import PluginStatus
from openlp.core.lib.pluginmanager import PluginManager
class TestPluginManager(TestCase):

View File

@ -30,7 +30,6 @@ from openlp.core.common import md5_hash
from openlp.core.common.registry import Registry
from openlp.core.common.settings import Settings
from openlp.core.lib import ItemCapabilities, ServiceItem, ServiceItemType, FormattingTags
from tests.helpers.testmixin import TestMixin
from tests.utils import assert_length, convert_file_service_item
from tests.utils.constants import RESOURCE_PATH

View File

@ -22,7 +22,6 @@
"""
Package to test the openlp.core.lib.theme package.
"""
import os
from pathlib import Path
from unittest import TestCase

View File

@ -26,7 +26,6 @@ from unittest import TestCase
from openlp.core.projectors.db import Projector
from openlp.core.projectors.pjlink import PJLink
from tests.resources.projector.data import TEST1_DATA

View File

@ -28,7 +28,6 @@ PREREQUISITE: add_record() and get_all() functions validated.
import os
import shutil
from tempfile import mkdtemp
from unittest import TestCase
from unittest.mock import patch
@ -36,7 +35,6 @@ from openlp.core.lib.db import upgrade_db
from openlp.core.projectors import upgrade
from openlp.core.projectors.constants import PJLINK_PORT
from openlp.core.projectors.db import Manufacturer, Model, Projector, ProjectorDB, ProjectorSource, Source
from tests.resources.projector.data import TEST_DB_PJLINK1, TEST_DB, TEST1_DATA, TEST2_DATA, TEST3_DATA
from tests.utils.constants import TEST_RESOURCES_PATH

View File

@ -28,7 +28,6 @@ from unittest.mock import call, patch, MagicMock
from openlp.core.projectors.constants import E_PARAMETER, ERROR_STRING, S_ON, S_CONNECTED, S_QSOCKET_STATE
from openlp.core.projectors.db import Projector
from openlp.core.projectors.pjlink import PJLink
from tests.resources.projector.data import TEST1_DATA
pjlink_test = PJLink(Projector(**TEST1_DATA), no_poll=True)

View File

@ -32,7 +32,6 @@ from openlp.core.projectors.constants import ERROR_STRING, PJLINK_ERST_DATA, PJL
S_CONNECTED, S_OFF, S_ON, S_NOT_CONNECTED, S_CONNECTING, S_STANDBY
from openlp.core.projectors.db import Projector
from openlp.core.projectors.pjlink import PJLink
from tests.resources.projector.data import TEST_PIN, TEST1_DATA
pjlink_test = PJLink(Projector(**TEST1_DATA), pin=TEST_PIN, no_poll=True)

View File

@ -29,7 +29,6 @@ import openlp.core.projectors.pjlink
from openlp.core.projectors.constants import S_CONNECTED
from openlp.core.projectors.db import Projector
from openlp.core.projectors.pjlink import PJLink
from tests.resources.projector.data import TEST_HASH, TEST_PIN, TEST_SALT, TEST1_DATA

View File

@ -19,7 +19,6 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
import os
import sys
from unittest import TestCase, skip
from unittest.mock import MagicMock, patch
@ -28,7 +27,6 @@ from PyQt5 import QtCore, QtWidgets
from openlp.core.app import OpenLP, parse_options
from openlp.core.common.settings import Settings
from tests.utils.constants import RESOURCE_PATH

View File

@ -27,7 +27,6 @@ from unittest import TestCase
from unittest.mock import patch
from openlp.core.ui.aboutform import AboutForm
from tests.helpers.testmixin import TestMixin

View File

@ -27,7 +27,6 @@ from unittest import TestCase
from openlp.core.common.registry import Registry
from openlp.core.ui.advancedtab import AdvancedTab
from openlp.core.ui.settingsform import SettingsForm
from tests.helpers.testmixin import TestMixin

View File

@ -24,14 +24,12 @@ Package to test the openlp.core.ui.exeptionform package.
"""
import os
import tempfile
from unittest import TestCase
from unittest.mock import call, patch
from openlp.core.common.registry import Registry
from openlp.core.common.path import Path
from openlp.core.common.registry import Registry
from openlp.core.ui import exceptionform
from tests.helpers.testmixin import TestMixin
exceptionform.WEBKIT_VERSION = 'Webkit Test'

View File

@ -26,7 +26,6 @@ from unittest import TestCase
from unittest.mock import patch
from openlp.core.common.httputils import CONNECTION_RETRIES, get_web_page
from tests.helpers.testmixin import TestMixin

View File

@ -24,14 +24,12 @@ Package to test the openlp.core.ui.firsttimeform package.
"""
import os
import tempfile
import urllib
from unittest import TestCase
from unittest.mock import MagicMock, patch
from openlp.core.common.registry import Registry
from openlp.core.common.path import Path
from openlp.core.common.registry import Registry
from openlp.core.ui.firsttimeform import FirstTimeForm
from tests.helpers.testmixin import TestMixin
FAKE_CONFIG = """

View File

@ -34,7 +34,6 @@ from openlp.core.display.screens import ScreenList
from openlp.core.lib import PluginManager
from openlp.core.ui import MainDisplay, AudioPlayer
from openlp.core.ui.maindisplay import TRANSPARENT_STYLESHEET, OPAQUE_STYLESHEET
from tests.helpers.testmixin import TestMixin
if is_macosx():

View File

@ -32,7 +32,6 @@ from openlp.core.common.i18n import UiStrings
from openlp.core.common.registry import Registry
from openlp.core.display.screens import ScreenList
from openlp.core.ui.mainwindow import MainWindow
from tests.helpers.testmixin import TestMixin
from tests.utils.constants import TEST_RESOURCES_PATH

View File

@ -28,7 +28,6 @@ from unittest.mock import patch
from PyQt5 import QtCore
from openlp.core.ui.media import get_media_players, parse_optical_path
from tests.helpers.testmixin import TestMixin

View File

@ -30,10 +30,9 @@ from unittest.mock import ANY, MagicMock, patch
from PyQt5 import QtWidgets
from openlp.core.common.registry import Registry
from openlp.core.common.path import Path
from openlp.core.common.registry import Registry
from openlp.core.ui import ThemeManager
from tests.utils.constants import TEST_RESOURCES_PATH

View File

@ -26,9 +26,8 @@ from unittest import TestCase
from unittest.mock import MagicMock
from openlp.core.common.registry import Registry
from openlp.core.ui.themestab import ThemesTab
from openlp.core.ui.settingsform import SettingsForm
from openlp.core.ui.themestab import ThemesTab
from tests.helpers.testmixin import TestMixin

View File

@ -27,9 +27,9 @@ from unittest import TestCase
from unittest.mock import MagicMock, PropertyMock, patch
from openlp.core.common.path import Path
from openlp.core.widgets.enums import PathEditType
from openlp.core.widgets.dialogs import FileDialog
from openlp.core.widgets.edits import PathEdit
from openlp.core.widgets.enums import PathEditType
class TestPathEdit(TestCase):

View File

@ -22,10 +22,8 @@
"""
This module contains tests for the CSV Bible importer.
"""
import os
import json
from unittest import TestCase
from unittest.mock import MagicMock, patch
from unittest.mock import MagicMock
from openlp.core.common.registry import Registry
from openlp.plugins.alerts.lib.alertsmanager import AlertsManager

View File

@ -26,8 +26,8 @@ from io import BytesIO
from unittest import TestCase
from unittest.mock import MagicMock, patch
from lxml import etree, objectify
from PyQt5.QtWidgets import QDialog
from lxml import etree, objectify
from openlp.core.common.i18n import Language
from openlp.core.common.path import Path

View File

@ -31,7 +31,6 @@ from openlp.core.common.path import Path
from openlp.core.lib.exceptions import ValidationError
from openlp.plugins.bibles.lib.bibleimport import BibleImport
from openlp.plugins.bibles.lib.importers.csvbible import Book, CSVBible, Verse
from tests.utils import load_external_result_data
from tests.utils.constants import RESOURCE_PATH

View File

@ -27,7 +27,6 @@ from unittest.mock import MagicMock, patch
from openlp.plugins.bibles import lib
from openlp.plugins.bibles.lib import SearchResults, get_reference_match
from tests.helpers.testmixin import TestMixin

View File

@ -27,12 +27,11 @@ from unittest.mock import MagicMock, call, patch
from PyQt5 import QtCore, QtWidgets
from tests.helpers.testmixin import TestMixin
from openlp.core.common.registry import Registry
from openlp.core.lib import MediaManagerItem
from openlp.plugins.bibles.lib.mediaitem import BibleMediaItem, BibleSearch, ResultsTab, SearchStatus, SearchTabs, \
get_reference_separators, VALID_TEXT_SEARCH
from tests.helpers.testmixin import TestMixin
class TestBibleMediaItemModulefunctions(TestCase):

View File

@ -28,7 +28,6 @@ from unittest.mock import MagicMock, call, patch
from openlp.plugins.bibles.lib.bibleimport import BibleImport
from openlp.plugins.bibles.lib.db import BibleDB
from openlp.plugins.bibles.lib.importers.osis import OSISBible
from tests.utils import load_external_result_data
from tests.utils.constants import RESOURCE_PATH

View File

@ -27,7 +27,6 @@ from unittest.mock import MagicMock, patch
from openlp.plugins.bibles.lib.db import BibleDB
from openlp.plugins.bibles.lib.importers.zefania import ZefaniaBible
from tests.utils import load_external_result_data
from tests.utils.constants import RESOURCE_PATH

View File

@ -27,10 +27,9 @@ from unittest.mock import MagicMock, patch
from PyQt5 import QtCore
from openlp.core.common.settings import Settings
from openlp.core.common.path import Path
from openlp.core.common.settings import Settings
from openlp.plugins.media.lib.mediaitem import MediaMediaItem
from tests.helpers.testmixin import TestMixin
__default_settings__ = {

View File

@ -27,7 +27,6 @@ from unittest.mock import patch
from openlp.core.common.registry import Registry
from openlp.plugins.media.mediaplugin import MediaPlugin, process_check_binary
from tests.helpers.testmixin import TestMixin

View File

@ -24,12 +24,12 @@ This module contains tests for the db submodule of the Songs plugin.
"""
import os
import shutil
from unittest import TestCase
from tempfile import mkdtemp
from unittest import TestCase
from openlp.plugins.songs.lib.db import Song, Author, AuthorType, Book
from openlp.plugins.songs.lib import upgrade
from openlp.core.lib.db import upgrade_db
from openlp.plugins.songs.lib import upgrade
from openlp.plugins.songs.lib.db import Song, Author, AuthorType, Book
from tests.utils.constants import TEST_RESOURCES_PATH

View File

@ -29,7 +29,6 @@ from PyQt5 import QtCore
from openlp.core.common.registry import Registry
from openlp.plugins.songs.forms.editsongform import EditSongForm
from tests.helpers.testmixin import TestMixin

View File

@ -29,7 +29,6 @@ from PyQt5 import QtCore
from openlp.core.common.settings import Settings
from openlp.plugins.songs.forms.editverseform import EditVerseForm
from tests.helpers.testmixin import TestMixin
__default_settings__ = {

View File

@ -28,7 +28,6 @@ from unittest.mock import MagicMock, patch
from openlp.core.common.registry import Registry
from openlp.plugins.songs.lib.importers.easyworship import EasyWorshipSongImport, FieldDescEntry, FieldType
from tests.utils.constants import RESOURCE_PATH
TEST_PATH = RESOURCE_PATH / 'easyworshipsongs'

View File

@ -32,7 +32,6 @@ from openlp.core.common.settings import Settings
from openlp.core.lib import ServiceItem
from openlp.plugins.songs.lib.db import AuthorType, Song
from openlp.plugins.songs.lib.mediaitem import SongMediaItem
from tests.helpers.testmixin import TestMixin

View File

@ -27,6 +27,7 @@ from unittest import TestCase, skipUnless
from unittest.mock import MagicMock, patch, call
from openlp.core.common.registry import Registry
try:
from openlp.plugins.songs.lib.importers.mediashout import MediaShoutImport
CAN_RUN_TESTS = True

View File

@ -26,10 +26,9 @@ from tempfile import mkdtemp
from unittest import TestCase
from unittest.mock import MagicMock, patch
from openlp.core.common.registry import Registry
from openlp.core.common.path import Path
from openlp.core.common.registry import Registry
from openlp.plugins.songs.lib.openlyricsexport import OpenLyricsExport
from tests.helpers.testmixin import TestMixin

View File

@ -33,7 +33,6 @@ from openlp.core.common.settings import Settings
from openlp.plugins.songs.lib.importers.openlyrics import OpenLyricsImport
from openlp.plugins.songs.lib.importers.songimport import SongImport
from openlp.plugins.songs.lib.openlyricsxml import OpenLyrics
from tests.helpers.testmixin import TestMixin
from tests.utils.constants import RESOURCE_PATH

View File

@ -26,7 +26,6 @@ from unittest import TestCase, skipIf
from unittest.mock import MagicMock, patch
from openlp.core.common.registry import Registry
from tests.helpers.testmixin import TestMixin
try:

View File

@ -27,7 +27,6 @@ from unittest.mock import patch, MagicMock
from openlp.core.common.registry import Registry
from openlp.plugins.songs.lib.importers.opensong import OpenSongImport
from tests.helpers.songfileimport import SongImportTestHelper
from tests.utils.constants import RESOURCE_PATH

View File

@ -27,7 +27,6 @@ from unittest.mock import MagicMock, patch
from openlp.core.common.registry import Registry
from openlp.plugins.songs.lib.importers.songbeamer import SongBeamerImport, SongBeamerTypes
from tests.helpers.songfileimport import SongImportTestHelper
from tests.utils.constants import RESOURCE_PATH

View File

@ -33,7 +33,6 @@ from openlp.core.common.registry import Registry
from openlp.plugins.songs.forms.songselectform import SongSelectForm, SearchWorker
from openlp.plugins.songs.lib import Song
from openlp.plugins.songs.lib.songselect import SongSelectImport, LOGOUT_URL, BASE_URL
from tests.helpers.songfileimport import SongImportTestHelper
from tests.helpers.testmixin import TestMixin
from tests.utils.constants import RESOURCE_PATH

View File

@ -27,7 +27,6 @@ from unittest.mock import patch, MagicMock
from openlp.plugins.songs.lib import VerseType
from openlp.plugins.songs.lib.importers.songshowplus import SongShowPlusImport
from tests.helpers.songfileimport import SongImportTestHelper
from tests.utils.constants import RESOURCE_PATH

View File

@ -28,7 +28,6 @@ from unittest.mock import MagicMock, patch
from openlp.core.common.registry import Registry
from openlp.plugins.songs.lib.importers.songimport import SongImport
from openlp.plugins.songs.lib.importers.zionworx import ZionWorxImport
from tests.helpers.songfileimport import SongImportTestHelper
from tests.utils.constants import RESOURCE_PATH

View File

@ -26,6 +26,7 @@ import os
from tempfile import mkstemp
from PyQt5 import QtCore, QtWidgets
from openlp.core.common.settings import Settings

View File

@ -23,9 +23,6 @@
The :mod:`tests.resources.projector.data file contains test data
"""
import os
from tempfile import gettempdir
# Test data
TEST_DB_PJLINK1 = 'projector_pjlink1.sqlite'

View File

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
import json
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
@ -20,7 +21,6 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
import os
import json
def assert_length(expected, iterable, msg=None):

View File

@ -23,8 +23,8 @@
The :mod:`osdinteraction` provides miscellaneous functions for interacting with
OSD files.
"""
import os
import json
import os
from tests.utils.constants import TEST_RESOURCES_PATH

View File

@ -23,9 +23,8 @@
Package to test for proper bzr tags.
"""
import os
from unittest import TestCase
from subprocess import Popen, PIPE
from unittest import TestCase
TAGS1 = {'1.9.0', '1.9.1', '1.9.2', '1.9.3', '1.9.4', '1.9.5', '1.9.6', '1.9.7', '1.9.8', '1.9.9', '1.9.10',
'1.9.11', '1.9.12', '2.0', '2.1.0', '2.1.1', '2.1.2', '2.1.3', '2.1.4', '2.1.5', '2.1.6', '2.2',

View File

@ -22,7 +22,6 @@
"""
Package to test for proper bzr tags.
"""
import os
import platform
import sys
from unittest import TestCase, SkipTest