From d59be6ca822e8e1b4b64f62882e4c497f0954350 Mon Sep 17 00:00:00 2001 From: Samuel Mehrbrodt Date: Thu, 3 Jul 2014 18:54:51 +0200 Subject: [PATCH] Move song import plugins to subfolder --- openlp/plugins/songs/forms/editsongform.py | 2 +- .../plugins/songs/forms/songreviewwidget.py | 2 +- openlp/plugins/songs/lib/importer.py | 34 ++++++------ openlp/plugins/songs/lib/mediaitem.py | 2 +- openlp/plugins/songs/lib/openlyricsexport.py | 2 +- .../songs/lib/{xml.py => openlyricsxml.py} | 0 .../plugins/songs/lib/songimport/__init__.py | 31 +++++++++++ .../lib/{ => songimport}/cclifileimport.py | 0 .../lib/{ => songimport}/dreambeamimport.py | 2 +- .../lib/{ => songimport}/easyslidesimport.py | 2 +- .../songs/lib/{ => songimport}/ewimport.py | 0 .../{ => songimport}/foilpresenterimport.py | 4 +- .../lib/{ => songimport}/mediashoutimport.py | 2 +- .../songs/lib/{ => songimport}/olpimport.py | 0 .../songs/lib/{ => songimport}/oooimport.py | 0 .../lib/{ => songimport}/openlyricsimport.py | 4 +- .../lib/{ => songimport}/opensongimport.py | 2 +- .../lib/{ => songimport}/powersongimport.py | 2 +- .../{ => songimport}/propresenterimport.py | 0 .../songs/lib/{ => songimport}/sofimport.py | 0 .../lib/{ => songimport}/songbeamerimport.py | 2 +- .../songs/lib/{ => songimport}/songimport.py | 2 +- .../lib/{ => songimport}/songproimport.py | 2 +- .../{ => songimport}/songshowplusimport.py | 2 +- .../lib/{ => songimport}/sundayplusimport.py | 2 +- .../worshipassistantimport.py | 2 +- .../worshipcenterproimport.py | 2 +- .../songs/lib/{ => songimport}/wowimport.py | 2 +- .../lib/{ => songimport}/zionworximport.py | 2 +- openlp/plugins/songs/lib/songselect.py | 2 +- openlp/plugins/songs/songsplugin.py | 2 +- .../openlp_plugins/songs/test_ewimport.py | 52 +++++++++---------- .../songs/test_foilpresenterimport.py | 30 +++++------ .../songs/test_openlyricsimport.py | 6 +-- .../songs/test_opensongimport.py | 10 ++-- .../songs/test_songbeamerimport.py | 10 ++-- .../songs/test_songshowplusimport.py | 12 ++--- .../songs/test_worshipcenterproimport.py | 4 +- .../songs/test_zionworximport.py | 6 +-- tests/helpers/songfileimport.py | 12 ++--- 40 files changed, 143 insertions(+), 112 deletions(-) rename openlp/plugins/songs/lib/{xml.py => openlyricsxml.py} (100%) create mode 100644 openlp/plugins/songs/lib/songimport/__init__.py rename openlp/plugins/songs/lib/{ => songimport}/cclifileimport.py (100%) rename openlp/plugins/songs/lib/{ => songimport}/dreambeamimport.py (99%) rename openlp/plugins/songs/lib/{ => songimport}/easyslidesimport.py (99%) rename openlp/plugins/songs/lib/{ => songimport}/ewimport.py (100%) rename openlp/plugins/songs/lib/{ => songimport}/foilpresenterimport.py (99%) rename openlp/plugins/songs/lib/{ => songimport}/mediashoutimport.py (98%) rename openlp/plugins/songs/lib/{ => songimport}/olpimport.py (100%) rename openlp/plugins/songs/lib/{ => songimport}/oooimport.py (100%) rename openlp/plugins/songs/lib/{ => songimport}/openlyricsimport.py (96%) rename openlp/plugins/songs/lib/{ => songimport}/opensongimport.py (99%) rename openlp/plugins/songs/lib/{ => songimport}/powersongimport.py (99%) rename openlp/plugins/songs/lib/{ => songimport}/propresenterimport.py (100%) rename openlp/plugins/songs/lib/{ => songimport}/sofimport.py (100%) rename openlp/plugins/songs/lib/{ => songimport}/songbeamerimport.py (99%) rename openlp/plugins/songs/lib/{ => songimport}/songimport.py (99%) rename openlp/plugins/songs/lib/{ => songimport}/songproimport.py (98%) rename openlp/plugins/songs/lib/{ => songimport}/songshowplusimport.py (99%) rename openlp/plugins/songs/lib/{ => songimport}/sundayplusimport.py (99%) rename openlp/plugins/songs/lib/{ => songimport}/worshipassistantimport.py (99%) rename openlp/plugins/songs/lib/{ => songimport}/worshipcenterproimport.py (98%) rename openlp/plugins/songs/lib/{ => songimport}/wowimport.py (99%) rename openlp/plugins/songs/lib/{ => songimport}/zionworximport.py (98%) diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 2125922fe..6b5ccb041 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -44,7 +44,7 @@ from openlp.core.lib.ui import set_case_insensitive_completer, critical_error_me from openlp.plugins.songs.lib import VerseType, clean_song from openlp.plugins.songs.lib.db import Book, Song, Author, AuthorType, Topic, MediaFile from openlp.plugins.songs.lib.ui import SongStrings -from openlp.plugins.songs.lib.xml import SongXML +from openlp.plugins.songs.lib.openlyricsxml import SongXML from openlp.plugins.songs.forms.editsongdialog import Ui_EditSongDialog from openlp.plugins.songs.forms.editverseform import EditVerseForm from openlp.plugins.songs.forms.mediafilesform import MediaFilesForm diff --git a/openlp/plugins/songs/forms/songreviewwidget.py b/openlp/plugins/songs/forms/songreviewwidget.py index 02d7b8774..7f5f9c0c6 100644 --- a/openlp/plugins/songs/forms/songreviewwidget.py +++ b/openlp/plugins/songs/forms/songreviewwidget.py @@ -33,7 +33,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import build_icon from openlp.plugins.songs.lib import VerseType -from openlp.plugins.songs.lib.xml import SongXML +from openlp.plugins.songs.lib.openlyricsxml import SongXML class SongReviewWidget(QtGui.QWidget): diff --git a/openlp/plugins/songs/lib/importer.py b/openlp/plugins/songs/lib/importer.py index 6d01da309..9c0b889ca 100644 --- a/openlp/plugins/songs/lib/importer.py +++ b/openlp/plugins/songs/lib/importer.py @@ -34,23 +34,23 @@ import logging from openlp.core.common import translate, UiStrings from openlp.core.ui.wizard import WizardStrings -from .opensongimport import OpenSongImport -from .easyslidesimport import EasySlidesImport -from .olpimport import OpenLPSongImport -from .openlyricsimport import OpenLyricsImport -from .wowimport import WowImport -from .cclifileimport import CCLIFileImport -from .dreambeamimport import DreamBeamImport -from .powersongimport import PowerSongImport -from .ewimport import EasyWorshipSongImport -from .songbeamerimport import SongBeamerImport -from .songshowplusimport import SongShowPlusImport -from .songproimport import SongProImport -from .sundayplusimport import SundayPlusImport -from .foilpresenterimport import FoilPresenterImport -from .zionworximport import ZionWorxImport -from .propresenterimport import ProPresenterImport -from .worshipassistantimport import WorshipAssistantImport +from .songimport.opensongimport import OpenSongImport +from .songimport.easyslidesimport import EasySlidesImport +from .songimport.olpimport import OpenLPSongImport +from .songimport.openlyricsimport import OpenLyricsImport +from .songimport.wowimport import WowImport +from .songimport.cclifileimport import CCLIFileImport +from .songimport.dreambeamimport import DreamBeamImport +from .songimport.powersongimport import PowerSongImport +from .songimport.ewimport import EasyWorshipSongImport +from .songimport.songbeamerimport import SongBeamerImport +from .songimport.songshowplusimport import SongShowPlusImport +from .songimport.songproimport import SongProImport +from .songimport.sundayplusimport import SundayPlusImport +from .songimport.foilpresenterimport import FoilPresenterImport +from .songimport.zionworximport import ZionWorxImport +from .songimport.propresenterimport import ProPresenterImport +from .songimport.worshipassistantimport import WorshipAssistantImport # Imports that might fail diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index d57c8fbcc..fde103c5f 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -46,7 +46,7 @@ from openlp.plugins.songs.forms.songexportform import SongExportForm from openlp.plugins.songs.lib import VerseType, clean_string, delete_song from openlp.plugins.songs.lib.db import Author, AuthorType, Song, Book, MediaFile from openlp.plugins.songs.lib.ui import SongStrings -from openlp.plugins.songs.lib.xml import OpenLyrics, SongXML +from openlp.plugins.songs.lib.openlyricsxml import OpenLyrics, SongXML log = logging.getLogger(__name__) diff --git a/openlp/plugins/songs/lib/openlyricsexport.py b/openlp/plugins/songs/lib/openlyricsexport.py index 72210e89f..0458b893b 100644 --- a/openlp/plugins/songs/lib/openlyricsexport.py +++ b/openlp/plugins/songs/lib/openlyricsexport.py @@ -37,7 +37,7 @@ from lxml import etree from openlp.core.common import RegistryProperties, check_directory_exists, translate from openlp.core.utils import clean_filename -from openlp.plugins.songs.lib.xml import OpenLyrics +from openlp.plugins.songs.lib.openlyricsxml import OpenLyrics log = logging.getLogger(__name__) diff --git a/openlp/plugins/songs/lib/xml.py b/openlp/plugins/songs/lib/openlyricsxml.py similarity index 100% rename from openlp/plugins/songs/lib/xml.py rename to openlp/plugins/songs/lib/openlyricsxml.py diff --git a/openlp/plugins/songs/lib/songimport/__init__.py b/openlp/plugins/songs/lib/songimport/__init__.py new file mode 100644 index 000000000..f57136ecf --- /dev/null +++ b/openlp/plugins/songs/lib/songimport/__init__.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2014 Raoul Snyman # +# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan # +# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, # +# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. # +# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # +# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # +# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # +# Frode Woldsund, Martin Zibricky, Patrick Zimmermann # +# --------------------------------------------------------------------------- # +# 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 # +############################################################################### +""" +The :mod:`~openlp.plugins.songs.lib.import` module contains a importers for the Songs plugin. +""" diff --git a/openlp/plugins/songs/lib/cclifileimport.py b/openlp/plugins/songs/lib/songimport/cclifileimport.py similarity index 100% rename from openlp/plugins/songs/lib/cclifileimport.py rename to openlp/plugins/songs/lib/songimport/cclifileimport.py diff --git a/openlp/plugins/songs/lib/dreambeamimport.py b/openlp/plugins/songs/lib/songimport/dreambeamimport.py similarity index 99% rename from openlp/plugins/songs/lib/dreambeamimport.py rename to openlp/plugins/songs/lib/songimport/dreambeamimport.py index 375867aac..e5afd65f4 100644 --- a/openlp/plugins/songs/lib/dreambeamimport.py +++ b/openlp/plugins/songs/lib/songimport/dreambeamimport.py @@ -35,7 +35,7 @@ import logging from lxml import etree, objectify from openlp.core.lib import translate -from openlp.plugins.songs.lib.songimport import SongImport +from openlp.plugins.songs.lib.songimport.songimport import SongImport from openlp.plugins.songs.lib.ui import SongStrings log = logging.getLogger(__name__) diff --git a/openlp/plugins/songs/lib/easyslidesimport.py b/openlp/plugins/songs/lib/songimport/easyslidesimport.py similarity index 99% rename from openlp/plugins/songs/lib/easyslidesimport.py rename to openlp/plugins/songs/lib/songimport/easyslidesimport.py index ca9a9b755..f30ae49e5 100644 --- a/openlp/plugins/songs/lib/easyslidesimport.py +++ b/openlp/plugins/songs/lib/songimport/easyslidesimport.py @@ -33,7 +33,7 @@ import re from lxml import etree, objectify from openlp.plugins.songs.lib import VerseType -from openlp.plugins.songs.lib.songimport import SongImport +from openlp.plugins.songs.lib.songimport.songimport import SongImport log = logging.getLogger(__name__) diff --git a/openlp/plugins/songs/lib/ewimport.py b/openlp/plugins/songs/lib/songimport/ewimport.py similarity index 100% rename from openlp/plugins/songs/lib/ewimport.py rename to openlp/plugins/songs/lib/songimport/ewimport.py diff --git a/openlp/plugins/songs/lib/foilpresenterimport.py b/openlp/plugins/songs/lib/songimport/foilpresenterimport.py similarity index 99% rename from openlp/plugins/songs/lib/foilpresenterimport.py rename to openlp/plugins/songs/lib/songimport/foilpresenterimport.py index 2b31718c2..67911de76 100644 --- a/openlp/plugins/songs/lib/foilpresenterimport.py +++ b/openlp/plugins/songs/lib/songimport/foilpresenterimport.py @@ -99,10 +99,10 @@ from lxml import etree, objectify from openlp.core.lib import translate from openlp.core.ui.wizard import WizardStrings from openlp.plugins.songs.lib import clean_song, VerseType -from openlp.plugins.songs.lib.songimport import SongImport +from openlp.plugins.songs.lib.songimport.songimport import SongImport from openlp.plugins.songs.lib.db import Author, Book, Song, Topic from openlp.plugins.songs.lib.ui import SongStrings -from openlp.plugins.songs.lib.xml import SongXML +from openlp.plugins.songs.lib.openlyricsxml import SongXML log = logging.getLogger(__name__) diff --git a/openlp/plugins/songs/lib/mediashoutimport.py b/openlp/plugins/songs/lib/songimport/mediashoutimport.py similarity index 98% rename from openlp/plugins/songs/lib/mediashoutimport.py rename to openlp/plugins/songs/lib/songimport/mediashoutimport.py index 99850e950..8eab61a96 100644 --- a/openlp/plugins/songs/lib/mediashoutimport.py +++ b/openlp/plugins/songs/lib/songimport/mediashoutimport.py @@ -33,7 +33,7 @@ a MediaShout database into the OpenLP database. import pyodbc from openlp.core.lib import translate -from openlp.plugins.songs.lib.songimport import SongImport +from openlp.plugins.songs.lib.songimport.songimport import SongImport VERSE_TAGS = ['V', 'C', 'B', 'O', 'P', 'I', 'E'] diff --git a/openlp/plugins/songs/lib/olpimport.py b/openlp/plugins/songs/lib/songimport/olpimport.py similarity index 100% rename from openlp/plugins/songs/lib/olpimport.py rename to openlp/plugins/songs/lib/songimport/olpimport.py diff --git a/openlp/plugins/songs/lib/oooimport.py b/openlp/plugins/songs/lib/songimport/oooimport.py similarity index 100% rename from openlp/plugins/songs/lib/oooimport.py rename to openlp/plugins/songs/lib/songimport/oooimport.py diff --git a/openlp/plugins/songs/lib/openlyricsimport.py b/openlp/plugins/songs/lib/songimport/openlyricsimport.py similarity index 96% rename from openlp/plugins/songs/lib/openlyricsimport.py rename to openlp/plugins/songs/lib/songimport/openlyricsimport.py index 031c5ba72..74329bfd8 100644 --- a/openlp/plugins/songs/lib/openlyricsimport.py +++ b/openlp/plugins/songs/lib/songimport/openlyricsimport.py @@ -37,9 +37,9 @@ import os from lxml import etree from openlp.core.ui.wizard import WizardStrings -from openlp.plugins.songs.lib.songimport import SongImport +from openlp.plugins.songs.lib.songimport.songimport import SongImport from openlp.plugins.songs.lib.ui import SongStrings -from openlp.plugins.songs.lib.xml import OpenLyrics, OpenLyricsError +from openlp.plugins.songs.lib.openlyricsxml import OpenLyrics, OpenLyricsError log = logging.getLogger(__name__) diff --git a/openlp/plugins/songs/lib/opensongimport.py b/openlp/plugins/songs/lib/songimport/opensongimport.py similarity index 99% rename from openlp/plugins/songs/lib/opensongimport.py rename to openlp/plugins/songs/lib/songimport/opensongimport.py index 3d9733dd8..a52b67b0f 100644 --- a/openlp/plugins/songs/lib/opensongimport.py +++ b/openlp/plugins/songs/lib/songimport/opensongimport.py @@ -35,7 +35,7 @@ from lxml.etree import Error, LxmlError from openlp.core.common import translate from openlp.plugins.songs.lib import VerseType -from openlp.plugins.songs.lib.songimport import SongImport +from openlp.plugins.songs.lib.songimport.songimport import SongImport from openlp.plugins.songs.lib.ui import SongStrings log = logging.getLogger(__name__) diff --git a/openlp/plugins/songs/lib/powersongimport.py b/openlp/plugins/songs/lib/songimport/powersongimport.py similarity index 99% rename from openlp/plugins/songs/lib/powersongimport.py rename to openlp/plugins/songs/lib/songimport/powersongimport.py index cd568bc2c..1cad5e33e 100644 --- a/openlp/plugins/songs/lib/powersongimport.py +++ b/openlp/plugins/songs/lib/songimport/powersongimport.py @@ -35,7 +35,7 @@ import fnmatch import os from openlp.core.common import translate -from openlp.plugins.songs.lib.songimport import SongImport +from openlp.plugins.songs.lib.songimport.songimport import SongImport log = logging.getLogger(__name__) diff --git a/openlp/plugins/songs/lib/propresenterimport.py b/openlp/plugins/songs/lib/songimport/propresenterimport.py similarity index 100% rename from openlp/plugins/songs/lib/propresenterimport.py rename to openlp/plugins/songs/lib/songimport/propresenterimport.py diff --git a/openlp/plugins/songs/lib/sofimport.py b/openlp/plugins/songs/lib/songimport/sofimport.py similarity index 100% rename from openlp/plugins/songs/lib/sofimport.py rename to openlp/plugins/songs/lib/songimport/sofimport.py diff --git a/openlp/plugins/songs/lib/songbeamerimport.py b/openlp/plugins/songs/lib/songimport/songbeamerimport.py similarity index 99% rename from openlp/plugins/songs/lib/songbeamerimport.py rename to openlp/plugins/songs/lib/songimport/songbeamerimport.py index 9c5e74c06..fbd016cda 100644 --- a/openlp/plugins/songs/lib/songbeamerimport.py +++ b/openlp/plugins/songs/lib/songimport/songbeamerimport.py @@ -36,7 +36,7 @@ import os import re from openlp.plugins.songs.lib import VerseType -from openlp.plugins.songs.lib.songimport import SongImport +from openlp.plugins.songs.lib.songimport.songimport import SongImport log = logging.getLogger(__name__) diff --git a/openlp/plugins/songs/lib/songimport.py b/openlp/plugins/songs/lib/songimport/songimport.py similarity index 99% rename from openlp/plugins/songs/lib/songimport.py rename to openlp/plugins/songs/lib/songimport/songimport.py index b8fcc604b..5382efbe5 100644 --- a/openlp/plugins/songs/lib/songimport.py +++ b/openlp/plugins/songs/lib/songimport/songimport.py @@ -39,7 +39,7 @@ from openlp.core.ui.wizard import WizardStrings from openlp.plugins.songs.lib import clean_song, VerseType from openlp.plugins.songs.lib.db import Song, Author, Topic, Book, MediaFile from openlp.plugins.songs.lib.ui import SongStrings -from openlp.plugins.songs.lib.xml import SongXML +from openlp.plugins.songs.lib.openlyricsxml import SongXML log = logging.getLogger(__name__) diff --git a/openlp/plugins/songs/lib/songproimport.py b/openlp/plugins/songs/lib/songimport/songproimport.py similarity index 98% rename from openlp/plugins/songs/lib/songproimport.py rename to openlp/plugins/songs/lib/songimport/songproimport.py index 86411a499..853a1d9eb 100644 --- a/openlp/plugins/songs/lib/songproimport.py +++ b/openlp/plugins/songs/lib/songimport/songproimport.py @@ -33,7 +33,7 @@ songs into the OpenLP database. import re from openlp.plugins.songs.lib import strip_rtf -from openlp.plugins.songs.lib.songimport import SongImport +from openlp.plugins.songs.lib.songimport.songimport import SongImport class SongProImport(SongImport): diff --git a/openlp/plugins/songs/lib/songshowplusimport.py b/openlp/plugins/songs/lib/songimport/songshowplusimport.py similarity index 99% rename from openlp/plugins/songs/lib/songshowplusimport.py rename to openlp/plugins/songs/lib/songimport/songshowplusimport.py index aebded029..352e55d96 100644 --- a/openlp/plugins/songs/lib/songshowplusimport.py +++ b/openlp/plugins/songs/lib/songimport/songshowplusimport.py @@ -38,7 +38,7 @@ import struct from openlp.core.ui.wizard import WizardStrings from openlp.plugins.songs.lib import VerseType, retrieve_windows_encoding -from openlp.plugins.songs.lib.songimport import SongImport +from openlp.plugins.songs.lib.songimport.songimport import SongImport TITLE = 1 AUTHOR = 2 diff --git a/openlp/plugins/songs/lib/sundayplusimport.py b/openlp/plugins/songs/lib/songimport/sundayplusimport.py similarity index 99% rename from openlp/plugins/songs/lib/sundayplusimport.py rename to openlp/plugins/songs/lib/songimport/sundayplusimport.py index 5c5f73047..fded3bca3 100644 --- a/openlp/plugins/songs/lib/sundayplusimport.py +++ b/openlp/plugins/songs/lib/songimport/sundayplusimport.py @@ -32,7 +32,7 @@ import re from openlp.plugins.songs.lib import VerseType, retrieve_windows_encoding from openlp.plugins.songs.lib import strip_rtf -from openlp.plugins.songs.lib.songimport import SongImport +from openlp.plugins.songs.lib.songimport.songimport import SongImport HOTKEY_TO_VERSE_TYPE = { '1': 'v1', diff --git a/openlp/plugins/songs/lib/worshipassistantimport.py b/openlp/plugins/songs/lib/songimport/worshipassistantimport.py similarity index 99% rename from openlp/plugins/songs/lib/worshipassistantimport.py rename to openlp/plugins/songs/lib/songimport/worshipassistantimport.py index 772fe8622..412a17c35 100644 --- a/openlp/plugins/songs/lib/worshipassistantimport.py +++ b/openlp/plugins/songs/lib/songimport/worshipassistantimport.py @@ -37,7 +37,7 @@ import re from openlp.core.common import translate from openlp.plugins.songs.lib import VerseType -from openlp.plugins.songs.lib.songimport import SongImport +from openlp.plugins.songs.lib.songimport.songimport import SongImport log = logging.getLogger(__name__) diff --git a/openlp/plugins/songs/lib/worshipcenterproimport.py b/openlp/plugins/songs/lib/songimport/worshipcenterproimport.py similarity index 98% rename from openlp/plugins/songs/lib/worshipcenterproimport.py rename to openlp/plugins/songs/lib/songimport/worshipcenterproimport.py index b24d2ae83..b6c32a8c0 100644 --- a/openlp/plugins/songs/lib/worshipcenterproimport.py +++ b/openlp/plugins/songs/lib/songimport/worshipcenterproimport.py @@ -35,7 +35,7 @@ import logging import pyodbc from openlp.core.common import translate -from openlp.plugins.songs.lib.songimport import SongImport +from openlp.plugins.songs.lib.songimport.songimport import SongImport log = logging.getLogger(__name__) diff --git a/openlp/plugins/songs/lib/wowimport.py b/openlp/plugins/songs/lib/songimport/wowimport.py similarity index 99% rename from openlp/plugins/songs/lib/wowimport.py rename to openlp/plugins/songs/lib/songimport/wowimport.py index c92b0ee2a..c135ca620 100644 --- a/openlp/plugins/songs/lib/wowimport.py +++ b/openlp/plugins/songs/lib/songimport/wowimport.py @@ -34,7 +34,7 @@ import os import logging from openlp.core.common import translate -from openlp.plugins.songs.lib.songimport import SongImport +from openlp.plugins.songs.lib.songimport.songimport import SongImport BLOCK_TYPES = ('V', 'C', 'B') diff --git a/openlp/plugins/songs/lib/zionworximport.py b/openlp/plugins/songs/lib/songimport/zionworximport.py similarity index 98% rename from openlp/plugins/songs/lib/zionworximport.py rename to openlp/plugins/songs/lib/songimport/zionworximport.py index dfdc2373d..8d939f244 100644 --- a/openlp/plugins/songs/lib/zionworximport.py +++ b/openlp/plugins/songs/lib/songimport/zionworximport.py @@ -34,7 +34,7 @@ import csv import logging from openlp.core.common import translate -from openlp.plugins.songs.lib.songimport import SongImport +from openlp.plugins.songs.lib.songimport.songimport import SongImport log = logging.getLogger(__name__) diff --git a/openlp/plugins/songs/lib/songselect.py b/openlp/plugins/songs/lib/songselect.py index 6fd084a47..61b02a66e 100644 --- a/openlp/plugins/songs/lib/songselect.py +++ b/openlp/plugins/songs/lib/songselect.py @@ -38,7 +38,7 @@ from html.parser import HTMLParser from bs4 import BeautifulSoup, NavigableString from openlp.plugins.songs.lib import Song, VerseType, clean_song, Author -from openlp.plugins.songs.lib.xml import SongXML +from openlp.plugins.songs.lib.openlyricsxml import SongXML USER_AGENT = 'Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; GT-I9000 ' \ 'Build/IML74K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 ' \ diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index 79fc282a6..c97e3835f 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -49,7 +49,7 @@ from openlp.plugins.songs.lib import clean_song, upgrade from openlp.plugins.songs.lib.db import init_schema, Song from openlp.plugins.songs.lib.mediaitem import SongSearch from openlp.plugins.songs.lib.importer import SongFormat -from openlp.plugins.songs.lib.olpimport import OpenLPSongImport +from openlp.plugins.songs.lib.songimport.olpimport import OpenLPSongImport from openlp.plugins.songs.lib.mediaitem import SongMediaItem from openlp.plugins.songs.lib.songstab import SongsTab diff --git a/tests/functional/openlp_plugins/songs/test_ewimport.py b/tests/functional/openlp_plugins/songs/test_ewimport.py index ea557711b..c28dc72aa 100644 --- a/tests/functional/openlp_plugins/songs/test_ewimport.py +++ b/tests/functional/openlp_plugins/songs/test_ewimport.py @@ -35,7 +35,7 @@ from unittest import TestCase from tests.functional import MagicMock, patch -from openlp.plugins.songs.lib.ewimport import EasyWorshipSongImport, FieldDescEntry, FieldType +from openlp.plugins.songs.lib.songimport.ewimport import EasyWorshipSongImport, FieldDescEntry, FieldType TEST_PATH = os.path.abspath( os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources', 'easyworshipsongs')) @@ -178,7 +178,7 @@ class TestEasyWorshipSongImport(TestCase): Test creating an instance of the EasyWorship file importer """ # GIVEN: A mocked out SongImport class, and a mocked out "manager" - with patch('openlp.plugins.songs.lib.ewimport.SongImport'): + with patch('openlp.plugins.songs.lib.songimport.ewimport.SongImport'): mocked_manager = MagicMock() # WHEN: An importer object is created @@ -192,7 +192,7 @@ class TestEasyWorshipSongImport(TestCase): Test finding an existing field in a given list using the :mod:`find_field` """ # GIVEN: A mocked out SongImport class, a mocked out "manager" and a list of field descriptions. - with patch('openlp.plugins.songs.lib.ewimport.SongImport'): + with patch('openlp.plugins.songs.lib.songimport.ewimport.SongImport'): mocked_manager = MagicMock() importer = EasyWorshipSongImport(mocked_manager, filenames=[]) importer.field_descriptions = TEST_FIELD_DESCS @@ -210,7 +210,7 @@ class TestEasyWorshipSongImport(TestCase): Test finding an non-existing field in a given list using the :mod:`find_field` """ # GIVEN: A mocked out SongImport class, a mocked out "manager" and a list of field descriptions - with patch('openlp.plugins.songs.lib.ewimport.SongImport'): + with patch('openlp.plugins.songs.lib.songimport.ewimport.SongImport'): mocked_manager = MagicMock() importer = EasyWorshipSongImport(mocked_manager, filenames=[]) importer.field_descriptions = TEST_FIELD_DESCS @@ -228,8 +228,8 @@ class TestEasyWorshipSongImport(TestCase): """ # GIVEN: A mocked out SongImport class, a mocked out struct class, and a mocked out "manager" and a list of # field descriptions - with patch('openlp.plugins.songs.lib.ewimport.SongImport'), \ - patch('openlp.plugins.songs.lib.ewimport.struct') as mocked_struct: + with patch('openlp.plugins.songs.lib.songimport.ewimport.SongImport'), \ + patch('openlp.plugins.songs.lib.songimport.ewimport.struct') as mocked_struct: mocked_manager = MagicMock() importer = EasyWorshipSongImport(mocked_manager, filenames=[]) @@ -246,7 +246,7 @@ class TestEasyWorshipSongImport(TestCase): Test the :mod:`get_field` module """ # GIVEN: A mocked out SongImport class, a mocked out "manager", an encoding and some test data and known results - with patch('openlp.plugins.songs.lib.ewimport.SongImport'): + with patch('openlp.plugins.songs.lib.songimport.ewimport.SongImport'): mocked_manager = MagicMock() importer = EasyWorshipSongImport(mocked_manager, filenames=[]) importer.encoding = TEST_DATA_ENCODING @@ -269,7 +269,7 @@ class TestEasyWorshipSongImport(TestCase): """ for test_results in GET_MEMO_FIELD_TEST_RESULTS: # GIVEN: A mocked out SongImport class, a mocked out "manager", a mocked out memo_file and an encoding - with patch('openlp.plugins.songs.lib.ewimport.SongImport'): + with patch('openlp.plugins.songs.lib.songimport.ewimport.SongImport'): mocked_manager = MagicMock() mocked_memo_file = MagicMock() importer = EasyWorshipSongImport(mocked_manager, filenames=[]) @@ -300,8 +300,8 @@ class TestEasyWorshipSongImport(TestCase): Test the :mod:`do_import` module opens the correct files """ # GIVEN: A mocked out SongImport class, a mocked out "manager" - with patch('openlp.plugins.songs.lib.ewimport.SongImport'), \ - patch('openlp.plugins.songs.lib.ewimport.os.path') as mocked_os_path: + with patch('openlp.plugins.songs.lib.songimport.ewimport.SongImport'), \ + patch('openlp.plugins.songs.lib.songimport.ewimport.os.path') as mocked_os_path: mocked_manager = MagicMock() importer = EasyWorshipSongImport(mocked_manager, filenames=[]) mocked_os_path.isfile.side_effect = [True, False] @@ -319,8 +319,8 @@ class TestEasyWorshipSongImport(TestCase): Test the :mod:`do_import` module produces an error when Songs.MB not found. """ # GIVEN: A mocked out SongImport class, a mocked out "manager" - with patch('openlp.plugins.songs.lib.ewimport.SongImport'), \ - patch('openlp.plugins.songs.lib.ewimport.os.path') as mocked_os_path: + with patch('openlp.plugins.songs.lib.songimport.ewimport.SongImport'), \ + patch('openlp.plugins.songs.lib.songimport.ewimport.os.path') as mocked_os_path: mocked_manager = MagicMock() importer = EasyWorshipSongImport(mocked_manager, filenames=[]) importer.log_error = MagicMock() @@ -339,8 +339,8 @@ class TestEasyWorshipSongImport(TestCase): Test the :mod:`do_import` module handles invalid database files correctly """ # GIVEN: A mocked out SongImport class, os.path and a mocked out "manager" - with patch('openlp.plugins.songs.lib.ewimport.SongImport'), \ - patch('openlp.plugins.songs.lib.ewimport.os.path') as mocked_os_path: + with patch('openlp.plugins.songs.lib.songimport.ewimport.SongImport'), \ + patch('openlp.plugins.songs.lib.songimport.ewimport.os.path') as mocked_os_path: mocked_manager = MagicMock() importer = EasyWorshipSongImport(mocked_manager, filenames=[]) mocked_os_path.isfile.return_value = True @@ -358,10 +358,10 @@ class TestEasyWorshipSongImport(TestCase): Test the :mod:`do_import` module handles invalid memo files correctly """ # GIVEN: A mocked out SongImport class, a mocked out "manager" - with patch('openlp.plugins.songs.lib.ewimport.SongImport'), \ - patch('openlp.plugins.songs.lib.ewimport.os.path') as mocked_os_path, \ + with patch('openlp.plugins.songs.lib.songimport.ewimport.SongImport'), \ + patch('openlp.plugins.songs.lib.songimport.ewimport.os.path') as mocked_os_path, \ patch('builtins.open') as mocked_open, \ - patch('openlp.plugins.songs.lib.ewimport.struct') as mocked_struct: + patch('openlp.plugins.songs.lib.songimport.ewimport.struct') as mocked_struct: mocked_manager = MagicMock() importer = EasyWorshipSongImport(mocked_manager, filenames=[]) mocked_os_path.isfile.return_value = True @@ -385,10 +385,10 @@ class TestEasyWorshipSongImport(TestCase): Test the :mod:`do_import` converts the code page to the encoding correctly """ # GIVEN: A mocked out SongImport class, a mocked out "manager" - with patch('openlp.plugins.songs.lib.ewimport.SongImport'), \ - patch('openlp.plugins.songs.lib.ewimport.os.path') as mocked_os_path, \ - patch('builtins.open'), patch('openlp.plugins.songs.lib.ewimport.struct') as mocked_struct, \ - patch('openlp.plugins.songs.lib.ewimport.retrieve_windows_encoding') as \ + with patch('openlp.plugins.songs.lib.songimport.ewimport.SongImport'), \ + patch('openlp.plugins.songs.lib.songimport.ewimport.os.path') as mocked_os_path, \ + patch('builtins.open'), patch('openlp.plugins.songs.lib.songimport.ewimport.struct') as mocked_struct, \ + patch('openlp.plugins.songs.lib.songimport.ewimport.retrieve_windows_encoding') as \ mocked_retrieve_windows_encoding: mocked_manager = MagicMock() importer = EasyWorshipSongImport(mocked_manager, filenames=[]) @@ -413,8 +413,8 @@ class TestEasyWorshipSongImport(TestCase): # GIVEN: Test files with a mocked out SongImport class, a mocked out "manager", a mocked out "import_wizard", # and mocked out "author", "add_copyright", "add_verse", "finish" methods. - with patch('openlp.plugins.songs.lib.ewimport.SongImport'), \ - patch('openlp.plugins.songs.lib.ewimport.retrieve_windows_encoding') as \ + with patch('openlp.plugins.songs.lib.songimport.ewimport.SongImport'), \ + patch('openlp.plugins.songs.lib.songimport.ewimport.retrieve_windows_encoding') as \ mocked_retrieve_windows_encoding: mocked_retrieve_windows_encoding.return_value = 'cp1252' mocked_manager = MagicMock() @@ -469,8 +469,8 @@ class TestEasyWorshipSongImport(TestCase): # GIVEN: Test files with a mocked out SongImport class, a mocked out "manager", a mocked out "import_wizard", # and mocked out "author", "add_copyright", "add_verse", "finish" methods. - with patch('openlp.plugins.songs.lib.ewimport.SongImport'), \ - patch('openlp.plugins.songs.lib.ewimport.retrieve_windows_encoding') \ + with patch('openlp.plugins.songs.lib.songimport.ewimport.SongImport'), \ + patch('openlp.plugins.songs.lib.songimport.ewimport.retrieve_windows_encoding') \ as mocked_retrieve_windows_encoding: mocked_retrieve_windows_encoding.return_value = 'cp1252' mocked_manager = MagicMock() @@ -509,7 +509,7 @@ class TestEasyWorshipSongImport(TestCase): """ # GIVEN: A mocked out SongImport class, a mocked out "manager" and mocked out "author" method. - with patch('openlp.plugins.songs.lib.ewimport.SongImport'): + with patch('openlp.plugins.songs.lib.songimport.ewimport.SongImport'): mocked_manager = MagicMock() mocked_add_author = MagicMock() importer = EasyWorshipSongImportLogger(mocked_manager) diff --git a/tests/functional/openlp_plugins/songs/test_foilpresenterimport.py b/tests/functional/openlp_plugins/songs/test_foilpresenterimport.py index 61206b9fa..15247a361 100644 --- a/tests/functional/openlp_plugins/songs/test_foilpresenterimport.py +++ b/tests/functional/openlp_plugins/songs/test_foilpresenterimport.py @@ -34,7 +34,7 @@ import os from unittest import TestCase from tests.functional import patch, MagicMock -from openlp.plugins.songs.lib.foilpresenterimport import FoilPresenter +from openlp.plugins.songs.lib.songimport.foilpresenterimport import FoilPresenter TEST_PATH = os.path.abspath( os.path.join(os.path.dirname(__file__), '..', '..', '..', '/resources/foilpresentersongs')) @@ -57,27 +57,27 @@ class TestFoilPresenter(TestCase): # _process_topics def setUp(self): - self.child_patcher = patch('openlp.plugins.songs.lib.foilpresenterimport.FoilPresenter._child') - self.clean_song_patcher = patch('openlp.plugins.songs.lib.foilpresenterimport.clean_song') - self.objectify_patcher = patch('openlp.plugins.songs.lib.foilpresenterimport.objectify') + self.child_patcher = patch('openlp.plugins.songs.lib.songimport.foilpresenterimport.FoilPresenter._child') + self.clean_song_patcher = patch('openlp.plugins.songs.lib.songimport.foilpresenterimport.clean_song') + self.objectify_patcher = patch('openlp.plugins.songs.lib.songimport.foilpresenterimport.objectify') self.process_authors_patcher = \ - patch('openlp.plugins.songs.lib.foilpresenterimport.FoilPresenter._process_authors') + patch('openlp.plugins.songs.lib.songimport.foilpresenterimport.FoilPresenter._process_authors') self.process_cclinumber_patcher = \ - patch('openlp.plugins.songs.lib.foilpresenterimport.FoilPresenter._process_cclinumber') + patch('openlp.plugins.songs.lib.songimport.foilpresenterimport.FoilPresenter._process_cclinumber') self.process_comments_patcher = \ - patch('openlp.plugins.songs.lib.foilpresenterimport.FoilPresenter._process_comments') + patch('openlp.plugins.songs.lib.songimport.foilpresenterimport.FoilPresenter._process_comments') self.process_lyrics_patcher = \ - patch('openlp.plugins.songs.lib.foilpresenterimport.FoilPresenter._process_lyrics') + patch('openlp.plugins.songs.lib.songimport.foilpresenterimport.FoilPresenter._process_lyrics') self.process_songbooks_patcher = \ - patch('openlp.plugins.songs.lib.foilpresenterimport.FoilPresenter._process_songbooks') + patch('openlp.plugins.songs.lib.songimport.foilpresenterimport.FoilPresenter._process_songbooks') self.process_titles_patcher = \ - patch('openlp.plugins.songs.lib.foilpresenterimport.FoilPresenter._process_titles') + patch('openlp.plugins.songs.lib.songimport.foilpresenterimport.FoilPresenter._process_titles') self.process_topics_patcher = \ - patch('openlp.plugins.songs.lib.foilpresenterimport.FoilPresenter._process_topics') - self.re_patcher = patch('openlp.plugins.songs.lib.foilpresenterimport.re') - self.song_patcher = patch('openlp.plugins.songs.lib.foilpresenterimport.Song') - self.song_xml_patcher = patch('openlp.plugins.songs.lib.foilpresenterimport.SongXML') - self.translate_patcher = patch('openlp.plugins.songs.lib.foilpresenterimport.translate') + patch('openlp.plugins.songs.lib.songimport.foilpresenterimport.FoilPresenter._process_topics') + self.re_patcher = patch('openlp.plugins.songs.lib.songimport.foilpresenterimport.re') + self.song_patcher = patch('openlp.plugins.songs.lib.songimport.foilpresenterimport.Song') + self.song_xml_patcher = patch('openlp.plugins.songs.lib.songimport.foilpresenterimport.SongXML') + self.translate_patcher = patch('openlp.plugins.songs.lib.songimport.foilpresenterimport.translate') self.mocked_child = self.child_patcher.start() self.mocked_clean_song = self.clean_song_patcher.start() diff --git a/tests/functional/openlp_plugins/songs/test_openlyricsimport.py b/tests/functional/openlp_plugins/songs/test_openlyricsimport.py index 93ecafb78..2166b950c 100644 --- a/tests/functional/openlp_plugins/songs/test_openlyricsimport.py +++ b/tests/functional/openlp_plugins/songs/test_openlyricsimport.py @@ -34,8 +34,8 @@ import os from unittest import TestCase from tests.functional import MagicMock, patch -from openlp.plugins.songs.lib.openlyricsimport import OpenLyricsImport -from openlp.plugins.songs.lib.songimport import SongImport +from openlp.plugins.songs.lib.songimport.openlyricsimport import OpenLyricsImport +from openlp.plugins.songs.lib.songimport.songimport import SongImport TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources', 'openlyricssongs')) @@ -69,7 +69,7 @@ class TestOpenLyricsImport(TestCase): Test creating an instance of the OpenLyrics file importer """ # GIVEN: A mocked out SongImport class, and a mocked out "manager" - with patch('openlp.plugins.songs.lib.songbeamerimport.SongImport'): + with patch('openlp.plugins.songs.lib.songimport.openlyricsimport.SongImport'): mocked_manager = MagicMock() # WHEN: An importer object is created diff --git a/tests/functional/openlp_plugins/songs/test_opensongimport.py b/tests/functional/openlp_plugins/songs/test_opensongimport.py index 96d6bff0b..8e7fee0af 100644 --- a/tests/functional/openlp_plugins/songs/test_opensongimport.py +++ b/tests/functional/openlp_plugins/songs/test_opensongimport.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- + # -*- coding: utf-8 -*- # vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4 ############################################################################### @@ -34,7 +34,7 @@ import os from unittest import TestCase from tests.helpers.songfileimport import SongImportTestHelper -from openlp.plugins.songs.lib.opensongimport import OpenSongImport +from openlp.plugins.songs.lib.songimport.opensongimport import OpenSongImport from tests.functional import patch, MagicMock TEST_PATH = os.path.abspath( @@ -69,7 +69,7 @@ class TestOpenSongImport(TestCase): Test creating an instance of the OpenSong file importer """ # GIVEN: A mocked out SongImport class, and a mocked out "manager" - with patch('openlp.plugins.songs.lib.opensongimport.SongImport'): + with patch('openlp.plugins.songs.lib.songimport.opensongimport.SongImport'): mocked_manager = MagicMock() # WHEN: An importer object is created @@ -83,7 +83,7 @@ class TestOpenSongImport(TestCase): Test OpenSongImport.do_import handles different invalid import_source values """ # GIVEN: A mocked out SongImport class, and a mocked out "manager" - with patch('openlp.plugins.songs.lib.opensongimport.SongImport'): + with patch('openlp.plugins.songs.lib.songimport.opensongimport.SongImport'): mocked_manager = MagicMock() mocked_import_wizard = MagicMock() importer = OpenSongImport(mocked_manager, filenames=[]) @@ -104,7 +104,7 @@ class TestOpenSongImport(TestCase): Test OpenSongImport.do_import handles different invalid import_source values """ # GIVEN: A mocked out SongImport class, and a mocked out "manager" - with patch('openlp.plugins.songs.lib.opensongimport.SongImport'): + with patch('openlp.plugins.songs.lib.songimport.opensongimport.SongImport'): mocked_manager = MagicMock() mocked_import_wizard = MagicMock() importer = OpenSongImport(mocked_manager, filenames=[]) diff --git a/tests/functional/openlp_plugins/songs/test_songbeamerimport.py b/tests/functional/openlp_plugins/songs/test_songbeamerimport.py index a69d4a86c..9ca0ab790 100644 --- a/tests/functional/openlp_plugins/songs/test_songbeamerimport.py +++ b/tests/functional/openlp_plugins/songs/test_songbeamerimport.py @@ -34,7 +34,7 @@ import os from unittest import TestCase from tests.functional import MagicMock, patch -from openlp.plugins.songs.lib.songbeamerimport import SongBeamerImport +from openlp.plugins.songs.lib.songimport.songbeamerimport import SongBeamerImport from openlp.plugins.songs.lib import VerseType TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), @@ -64,7 +64,7 @@ class TestSongBeamerImport(TestCase): Test creating an instance of the SongBeamer file importer """ # GIVEN: A mocked out SongImport class, and a mocked out "manager" - with patch('openlp.plugins.songs.lib.songbeamerimport.SongImport'): + with patch('openlp.plugins.songs.lib.songimport.songbeamerimport.SongImport'): mocked_manager = MagicMock() # WHEN: An importer object is created @@ -78,7 +78,7 @@ class TestSongBeamerImport(TestCase): Test SongBeamerImport.do_import handles different invalid import_source values """ # GIVEN: A mocked out SongImport class, and a mocked out "manager" - with patch('openlp.plugins.songs.lib.songbeamerimport.SongImport'): + with patch('openlp.plugins.songs.lib.songimport.songbeamerimport.SongImport'): mocked_manager = MagicMock() mocked_import_wizard = MagicMock() importer = SongBeamerImport(mocked_manager, filenames=[]) @@ -99,7 +99,7 @@ class TestSongBeamerImport(TestCase): Test SongBeamerImport.do_import handles different invalid import_source values """ # GIVEN: A mocked out SongImport class, and a mocked out "manager" - with patch('openlp.plugins.songs.lib.songbeamerimport.SongImport'): + with patch('openlp.plugins.songs.lib.songimport.songbeamerimport.SongImport'): mocked_manager = MagicMock() mocked_import_wizard = MagicMock() importer = SongBeamerImport(mocked_manager, filenames=[]) @@ -122,7 +122,7 @@ class TestSongBeamerImport(TestCase): # GIVEN: Test files with a mocked out SongImport class, a mocked out "manager", a mocked out "import_wizard", # and mocked out "author", "add_copyright", "add_verse", "finish" methods. - with patch('openlp.plugins.songs.lib.songbeamerimport.SongImport'): + with patch('openlp.plugins.songs.lib.songimport.songbeamerimport.SongImport'): for song_file in SONG_TEST_DATA: mocked_manager = MagicMock() mocked_import_wizard = MagicMock() diff --git a/tests/functional/openlp_plugins/songs/test_songshowplusimport.py b/tests/functional/openlp_plugins/songs/test_songshowplusimport.py index dfee265e3..8d6a42287 100644 --- a/tests/functional/openlp_plugins/songs/test_songshowplusimport.py +++ b/tests/functional/openlp_plugins/songs/test_songshowplusimport.py @@ -35,7 +35,7 @@ from unittest import TestCase from tests.helpers.songfileimport import SongImportTestHelper from openlp.plugins.songs.lib import VerseType -from openlp.plugins.songs.lib.songshowplusimport import SongShowPlusImport +from openlp.plugins.songs.lib.songimport.songshowplusimport import SongShowPlusImport from tests.functional import patch, MagicMock TEST_PATH = os.path.abspath( @@ -70,7 +70,7 @@ class TestSongShowPlusImport(TestCase): Test creating an instance of the SongShow Plus file importer """ # GIVEN: A mocked out SongImport class, and a mocked out "manager" - with patch('openlp.plugins.songs.lib.songshowplusimport.SongImport'): + with patch('openlp.plugins.songs.lib.songimport.songshowplusimport.SongImport'): mocked_manager = MagicMock() # WHEN: An importer object is created @@ -84,7 +84,7 @@ class TestSongShowPlusImport(TestCase): Test SongShowPlusImport.do_import handles different invalid import_source values """ # GIVEN: A mocked out SongImport class, and a mocked out "manager" - with patch('openlp.plugins.songs.lib.songshowplusimport.SongImport'): + with patch('openlp.plugins.songs.lib.songimport.songshowplusimport.SongImport'): mocked_manager = MagicMock() mocked_import_wizard = MagicMock() importer = SongShowPlusImport(mocked_manager, filenames=[]) @@ -105,7 +105,7 @@ class TestSongShowPlusImport(TestCase): Test SongShowPlusImport.do_import handles different invalid import_source values """ # GIVEN: A mocked out SongImport class, and a mocked out "manager" - with patch('openlp.plugins.songs.lib.songshowplusimport.SongImport'): + with patch('openlp.plugins.songs.lib.songimport.songshowplusimport.SongImport'): mocked_manager = MagicMock() mocked_import_wizard = MagicMock() importer = SongShowPlusImport(mocked_manager, filenames=[]) @@ -126,7 +126,7 @@ class TestSongShowPlusImport(TestCase): Test to_openlp_verse_tag method by simulating adding a verse """ # GIVEN: A mocked out SongImport class, and a mocked out "manager" - with patch('openlp.plugins.songs.lib.songshowplusimport.SongImport'): + with patch('openlp.plugins.songs.lib.songimport.songshowplusimport.SongImport'): mocked_manager = MagicMock() importer = SongShowPlusImport(mocked_manager, filenames=[]) @@ -154,7 +154,7 @@ class TestSongShowPlusImport(TestCase): Test to_openlp_verse_tag method by simulating adding a verse to the verse order """ # GIVEN: A mocked out SongImport class, and a mocked out "manager" - with patch('openlp.plugins.songs.lib.songshowplusimport.SongImport'): + with patch('openlp.plugins.songs.lib.songimport.songshowplusimport.SongImport'): mocked_manager = MagicMock() importer = SongShowPlusImport(mocked_manager, filenames=[]) diff --git a/tests/functional/openlp_plugins/songs/test_worshipcenterproimport.py b/tests/functional/openlp_plugins/songs/test_worshipcenterproimport.py index 9a58a6c2b..263397cc9 100644 --- a/tests/functional/openlp_plugins/songs/test_worshipcenterproimport.py +++ b/tests/functional/openlp_plugins/songs/test_worshipcenterproimport.py @@ -37,7 +37,7 @@ if os.name != 'nt': import pyodbc -from openlp.plugins.songs.lib.worshipcenterproimport import WorshipCenterProImport +from openlp.plugins.songs.lib.songimport.worshipcenterproimport import WorshipCenterProImport from tests.functional import patch, MagicMock @@ -141,7 +141,7 @@ class TestWorshipCenterProSongImport(TestCase): Test creating an instance of the WorshipCenter Pro file importer """ # GIVEN: A mocked out SongImport class, and a mocked out "manager" - with patch('openlp.plugins.songs.lib.worshipcenterproimport.SongImport'): + with patch('openlp.plugins.songs.lib.songimport.worshipcenterproimport.SongImport'): mocked_manager = MagicMock() # WHEN: An importer object is created diff --git a/tests/functional/openlp_plugins/songs/test_zionworximport.py b/tests/functional/openlp_plugins/songs/test_zionworximport.py index c5669e9c8..a3f5bb20b 100644 --- a/tests/functional/openlp_plugins/songs/test_zionworximport.py +++ b/tests/functional/openlp_plugins/songs/test_zionworximport.py @@ -33,8 +33,8 @@ This module contains tests for the ZionWorx song importer. from unittest import TestCase from tests.functional import MagicMock, patch -from openlp.plugins.songs.lib.zionworximport import ZionWorxImport -from openlp.plugins.songs.lib.songimport import SongImport +from openlp.plugins.songs.lib.songimport.zionworximport import ZionWorxImport +from openlp.plugins.songs.lib.songimport.songimport import SongImport class TestZionWorxImport(TestCase): @@ -46,7 +46,7 @@ class TestZionWorxImport(TestCase): Test creating an instance of the ZionWorx file importer """ # GIVEN: A mocked out SongImport class, and a mocked out "manager" - with patch('openlp.plugins.songs.lib.zionworximport.SongImport'): + with patch('openlp.plugins.songs.lib.songimport.zionworximport.SongImport'): mocked_manager = MagicMock() # WHEN: An importer object is created diff --git a/tests/helpers/songfileimport.py b/tests/helpers/songfileimport.py index 80b2ee268..0b0e3515d 100644 --- a/tests/helpers/songfileimport.py +++ b/tests/helpers/songfileimport.py @@ -43,7 +43,7 @@ class SongImportTestHelper(TestCase): def __init__(self, *args, **kwargs): super(SongImportTestHelper, self).__init__(*args, **kwargs) self.importer_module = __import__( - 'openlp.plugins.songs.lib.%s' % self.importer_module_name, fromlist=[self.importer_class_name]) + 'openlp.plugins.songs.lib.songimport.%s' % self.importer_module_name, fromlist=[self.importer_class_name]) self.importer_class = getattr(self.importer_module, self.importer_class_name) def setUp(self): @@ -51,14 +51,14 @@ class SongImportTestHelper(TestCase): Patch and set up the mocks required. """ self.add_copyright_patcher = patch( - 'openlp.plugins.songs.lib.%s.%s.add_copyright' % (self.importer_module_name, self.importer_class_name)) + 'openlp.plugins.songs.lib.songimport.%s.%s.add_copyright' % (self.importer_module_name, self.importer_class_name)) self.add_verse_patcher = patch( - 'openlp.plugins.songs.lib.%s.%s.add_verse' % (self.importer_module_name, self.importer_class_name)) + 'openlp.plugins.songs.lib.songimport.%s.%s.add_verse' % (self.importer_module_name, self.importer_class_name)) self.finish_patcher = patch( - 'openlp.plugins.songs.lib.%s.%s.finish' % (self.importer_module_name, self.importer_class_name)) + 'openlp.plugins.songs.lib.songimport.%s.%s.finish' % (self.importer_module_name, self.importer_class_name)) self.add_author_patcher = patch( - 'openlp.plugins.songs.lib.%s.%s.add_author' % (self.importer_module_name, self.importer_class_name)) - self.song_import_patcher = patch('openlp.plugins.songs.lib.%s.SongImport' % self.importer_module_name) + 'openlp.plugins.songs.lib.songimport.%s.%s.add_author' % (self.importer_module_name, self.importer_class_name)) + self.song_import_patcher = patch('openlp.plugins.songs.lib.songimport.%s.SongImport' % self.importer_module_name) self.mocked_add_copyright = self.add_copyright_patcher.start() self.mocked_add_verse = self.add_verse_patcher.start() self.mocked_finish = self.finish_patcher.start()