More renaming

This commit is contained in:
Samuel Mehrbrodt 2014-07-04 11:31:06 +02:00
parent c9b47e8e6f
commit 686f8d2437
36 changed files with 131 additions and 131 deletions

View File

@ -34,23 +34,23 @@ import logging
from openlp.core.common import translate, UiStrings from openlp.core.common import translate, UiStrings
from openlp.core.ui.wizard import WizardStrings from openlp.core.ui.wizard import WizardStrings
from .songimport.opensongimport import OpenSongImport from .importers.opensong import OpenSongImport
from .songimport.easyslidesimport import EasySlidesImport from .importers.easyslides import EasySlidesImport
from .songimport.olpimport import OpenLPSongImport from .importers.openlp import OpenLPSongImport
from .songimport.openlyricsimport import OpenLyricsImport from .importers.openlyrics import OpenLyricsImport
from .songimport.wowimport import WowImport from .importers.wordsofworship import WordsOfWorshipImport
from .songimport.cclifileimport import CCLIFileImport from .importers.cclifile import CCLIFileImport
from .songimport.dreambeamimport import DreamBeamImport from .importers.dreambeam import DreamBeamImport
from .songimport.powersongimport import PowerSongImport from .importers.powersong import PowerSongImport
from .songimport.ewimport import EasyWorshipSongImport from .importers.easyworship import EasyWorshipSongImport
from .songimport.songbeamerimport import SongBeamerImport from .importers.songbeamer import SongBeamerImport
from .songimport.songshowplusimport import SongShowPlusImport from .importers.songshowplus import SongShowPlusImport
from .songimport.songproimport import SongProImport from .importers.songpro import SongProImport
from .songimport.sundayplusimport import SundayPlusImport from .importers.sundayplus import SundayPlusImport
from .songimport.foilpresenterimport import FoilPresenterImport from .importers.foilpresenter import FoilPresenterImport
from .songimport.zionworximport import ZionWorxImport from .importers.zionworx import ZionWorxImport
from .songimport.propresenterimport import ProPresenterImport from .importers.propresenter import ProPresenterImport
from .songimport.worshipassistantimport import WorshipAssistantImport from .importers.worshipassistant import WorshipAssistantImport
# Imports that might fail # Imports that might fail
@ -58,13 +58,13 @@ log = logging.getLogger(__name__)
try: try:
from .sofimport import SofImport from .importers.songsoffellowship import SongsOfFellowshipImport
HAS_SOF = True HAS_SOF = True
except ImportError: except ImportError:
log.exception('Error importing %s', 'SofImport') log.exception('Error importing %s', 'SongsOfFellowshipImport')
HAS_SOF = False HAS_SOF = False
try: try:
from .oooimport import OooImport from .importers.openoffice import OpenOfficeImport
HAS_OOO = True HAS_OOO = True
except ImportError: except ImportError:
log.exception('Error importing %s', 'OooImport') log.exception('Error importing %s', 'OooImport')
@ -72,14 +72,14 @@ except ImportError:
HAS_MEDIASHOUT = False HAS_MEDIASHOUT = False
if os.name == 'nt': if os.name == 'nt':
try: try:
from .mediashoutimport import MediaShoutImport from .importers.mediashout import MediaShoutImport
HAS_MEDIASHOUT = True HAS_MEDIASHOUT = True
except ImportError: except ImportError:
log.exception('Error importing %s', 'MediaShoutImport') log.exception('Error importing %s', 'MediaShoutImport')
HAS_WORSHIPCENTERPRO = False HAS_WORSHIPCENTERPRO = False
if os.name == 'nt': if os.name == 'nt':
try: try:
from .worshipcenterproimport import WorshipCenterProImport from .importers.worshipcenterpro import WorshipCenterProImport
HAS_WORSHIPCENTERPRO = True HAS_WORSHIPCENTERPRO = True
except ImportError: except ImportError:
log.exception('Error importing %s', 'WorshipCenterProImport') log.exception('Error importing %s', 'WorshipCenterProImport')
@ -109,7 +109,7 @@ class SongFormat(object):
Name of the format, e.g. ``'OpenLyrics'`` Name of the format, e.g. ``'OpenLyrics'``
``'prefix'`` ``'prefix'``
Prefix for Qt objects. Use mixedCase, e.g. ``'open_lyrics'`` Prefix for Qt objects. Use mixedCase, e.g. ``'openLyrics'``
See ``SongImportForm.add_file_select_item()`` See ``SongImportForm.add_file_select_item()``
Optional attributes for each song format: Optional attributes for each song format:
@ -190,7 +190,7 @@ class SongFormat(object):
OpenLyrics: { OpenLyrics: {
'class': OpenLyricsImport, 'class': OpenLyricsImport,
'name': 'OpenLyrics', 'name': 'OpenLyrics',
'prefix': 'open_lyrics', 'prefix': 'openLyrics',
'filter': '%s (*.xml)' % translate('SongsPlugin.ImportWizardForm', 'OpenLyrics Files'), 'filter': '%s (*.xml)' % translate('SongsPlugin.ImportWizardForm', 'OpenLyrics Files'),
'comboBoxText': translate('SongsPlugin.ImportWizardForm', 'OpenLyrics or OpenLP 2.0 Exported Song') 'comboBoxText': translate('SongsPlugin.ImportWizardForm', 'OpenLyrics or OpenLP 2.0 Exported Song')
}, },
@ -318,7 +318,7 @@ class SongFormat(object):
'filter': '%s (*.ptf)' % translate('SongsPlugin.ImportWizardForm', 'SundayPlus Song Files') 'filter': '%s (*.ptf)' % translate('SongsPlugin.ImportWizardForm', 'SundayPlus Song Files')
}, },
WordsOfWorship: { WordsOfWorship: {
'class': WowImport, 'class': WordsOfWorshipImport,
'name': 'Words of Worship', 'name': 'Words of Worship',
'prefix': 'wordsOfWorship', 'prefix': 'wordsOfWorship',
'filter': '%s (*.wsg *.wow-song)' % translate('SongsPlugin.ImportWizardForm', 'Words Of Worship Song Files') 'filter': '%s (*.wsg *.wow-song)' % translate('SongsPlugin.ImportWizardForm', 'Words Of Worship Song Files')
@ -423,10 +423,10 @@ class SongFormat(object):
SongFormat.set(SongFormat.SongsOfFellowship, 'availability', HAS_SOF) SongFormat.set(SongFormat.SongsOfFellowship, 'availability', HAS_SOF)
if HAS_SOF: if HAS_SOF:
SongFormat.set(SongFormat.SongsOfFellowship, 'class', SofImport) SongFormat.set(SongFormat.SongsOfFellowship, 'class', SongsOfFellowshipImport)
SongFormat.set(SongFormat.Generic, 'availability', HAS_OOO) SongFormat.set(SongFormat.Generic, 'availability', HAS_OOO)
if HAS_OOO: if HAS_OOO:
SongFormat.set(SongFormat.Generic, 'class', OooImport) SongFormat.set(SongFormat.Generic, 'class', OpenOfficeImport)
SongFormat.set(SongFormat.MediaShout, 'availability', HAS_MEDIASHOUT) SongFormat.set(SongFormat.MediaShout, 'availability', HAS_MEDIASHOUT)
if HAS_MEDIASHOUT: if HAS_MEDIASHOUT:
SongFormat.set(SongFormat.MediaShout, 'class', MediaShoutImport) SongFormat.set(SongFormat.MediaShout, 'class', MediaShoutImport)

View File

@ -35,7 +35,7 @@ import logging
from lxml import etree, objectify from lxml import etree, objectify
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.plugins.songs.lib.songimport.songimport import SongImport from openlp.plugins.songs.lib.importers.songimport import SongImport
from openlp.plugins.songs.lib.ui import SongStrings from openlp.plugins.songs.lib.ui import SongStrings
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View File

@ -33,7 +33,7 @@ import re
from lxml import etree, objectify from lxml import etree, objectify
from openlp.plugins.songs.lib import VerseType from openlp.plugins.songs.lib import VerseType
from openlp.plugins.songs.lib.songimport.songimport import SongImport from openlp.plugins.songs.lib.importers.songimport import SongImport
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View File

@ -99,7 +99,7 @@ from lxml import etree, objectify
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.core.ui.wizard import WizardStrings from openlp.core.ui.wizard import WizardStrings
from openlp.plugins.songs.lib import clean_song, VerseType from openlp.plugins.songs.lib import clean_song, VerseType
from openlp.plugins.songs.lib.songimport.songimport import SongImport from openlp.plugins.songs.lib.importers.songimport import SongImport
from openlp.plugins.songs.lib.db import Author, Book, Song, Topic from openlp.plugins.songs.lib.db import Author, Book, Song, Topic
from openlp.plugins.songs.lib.ui import SongStrings from openlp.plugins.songs.lib.ui import SongStrings
from openlp.plugins.songs.lib.openlyricsxml import SongXML from openlp.plugins.songs.lib.openlyricsxml import SongXML

View File

@ -33,7 +33,7 @@ a MediaShout database into the OpenLP database.
import pyodbc import pyodbc
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.plugins.songs.lib.songimport.songimport import SongImport from openlp.plugins.songs.lib.importers.songimport import SongImport
VERSE_TAGS = ['V', 'C', 'B', 'O', 'P', 'I', 'E'] VERSE_TAGS = ['V', 'C', 'B', 'O', 'P', 'I', 'E']

View File

@ -37,7 +37,7 @@ import os
from lxml import etree from lxml import etree
from openlp.core.ui.wizard import WizardStrings from openlp.core.ui.wizard import WizardStrings
from openlp.plugins.songs.lib.songimport.songimport import SongImport from openlp.plugins.songs.lib.importers.songimport import SongImport
from openlp.plugins.songs.lib.ui import SongStrings from openlp.plugins.songs.lib.ui import SongStrings
from openlp.plugins.songs.lib.openlyricsxml import OpenLyrics, OpenLyricsError from openlp.plugins.songs.lib.openlyricsxml import OpenLyrics, OpenLyricsError

View File

@ -52,7 +52,7 @@ except ImportError:
PAGE_BOTH = 6 PAGE_BOTH = 6
class OooImport(SongImport): class OpenOfficeImport(SongImport):
""" """
Import songs from Impress/Powerpoint docs using Impress Import songs from Impress/Powerpoint docs using Impress
""" """

View File

@ -35,7 +35,7 @@ from lxml.etree import Error, LxmlError
from openlp.core.common import translate from openlp.core.common import translate
from openlp.plugins.songs.lib import VerseType from openlp.plugins.songs.lib import VerseType
from openlp.plugins.songs.lib.songimport.songimport import SongImport from openlp.plugins.songs.lib.importers.songimport import SongImport
from openlp.plugins.songs.lib.ui import SongStrings from openlp.plugins.songs.lib.ui import SongStrings
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View File

@ -35,7 +35,7 @@ import fnmatch
import os import os
from openlp.core.common import translate from openlp.core.common import translate
from openlp.plugins.songs.lib.songimport.songimport import SongImport from openlp.plugins.songs.lib.importers.songimport import SongImport
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -90,7 +90,7 @@ class PowerSongImport(SongImport):
""" """
Receive either a list of files or a folder (unicode) to import. Receive either a list of files or a folder (unicode) to import.
""" """
from .importer import SongFormat from openlp.plugins.songs.lib.importer import SongFormat
ps_string = SongFormat.get(SongFormat.PowerSong, 'name') ps_string = SongFormat.get(SongFormat.PowerSong, 'name')
if isinstance(self.import_source, str): if isinstance(self.import_source, str):
if os.path.isdir(self.import_source): if os.path.isdir(self.import_source):

View File

@ -36,7 +36,7 @@ import os
import re import re
from openlp.plugins.songs.lib import VerseType from openlp.plugins.songs.lib import VerseType
from openlp.plugins.songs.lib.songimport.songimport import SongImport from openlp.plugins.songs.lib.importers.songimport import SongImport
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View File

@ -33,7 +33,7 @@ songs into the OpenLP database.
import re import re
from openlp.plugins.songs.lib import strip_rtf from openlp.plugins.songs.lib import strip_rtf
from openlp.plugins.songs.lib.songimport.songimport import SongImport from openlp.plugins.songs.lib.importers.songimport import SongImport
class SongProImport(SongImport): class SongProImport(SongImport):

View File

@ -38,7 +38,7 @@ import struct
from openlp.core.ui.wizard import WizardStrings from openlp.core.ui.wizard import WizardStrings
from openlp.plugins.songs.lib import VerseType, retrieve_windows_encoding from openlp.plugins.songs.lib import VerseType, retrieve_windows_encoding
from openlp.plugins.songs.lib.songimport.songimport import SongImport from openlp.plugins.songs.lib.importers.songimport import SongImport
TITLE = 1 TITLE = 1
AUTHOR = 2 AUTHOR = 2

View File

@ -37,13 +37,13 @@ import logging
import os import os
import re import re
from .oooimport import OooImport from .openoffice import OpenOfficeImport
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
if os.name == 'nt': if os.name == 'nt':
from .oooimport import PAGE_BEFORE, PAGE_AFTER, PAGE_BOTH from .openoffice import PAGE_BEFORE, PAGE_AFTER, PAGE_BOTH
RuntimeException = Exception RuntimeException = Exception
else: else:
try: try:
@ -62,7 +62,7 @@ except ImportError:
ITALIC = 2 ITALIC = 2
class SofImport(OooImport): class SongsOfFellowshipImport(OpenOfficeImport):
""" """
Import songs provided on disks with the Songs of Fellowship music books Import songs provided on disks with the Songs of Fellowship music books
VOLS1_2.RTF, sof3words.rtf and sof4words.rtf VOLS1_2.RTF, sof3words.rtf and sof4words.rtf
@ -83,7 +83,7 @@ class SofImport(OooImport):
Initialise the class. Requires a songmanager class which is passed Initialise the class. Requires a songmanager class which is passed
to SongImport for writing song to disk to SongImport for writing song to disk
""" """
OooImport.__init__(self, manager, **kwargs) OpenOfficeImport.__init__(self, manager, **kwargs)
self.song = False self.song = False
def process_ooo_document(self): def process_ooo_document(self):

View File

@ -32,7 +32,7 @@ import re
from openlp.plugins.songs.lib import VerseType, retrieve_windows_encoding from openlp.plugins.songs.lib import VerseType, retrieve_windows_encoding
from openlp.plugins.songs.lib import strip_rtf from openlp.plugins.songs.lib import strip_rtf
from openlp.plugins.songs.lib.songimport.songimport import SongImport from openlp.plugins.songs.lib.importers.songimport import SongImport
HOTKEY_TO_VERSE_TYPE = { HOTKEY_TO_VERSE_TYPE = {
'1': 'v1', '1': 'v1',

View File

@ -34,14 +34,14 @@ import os
import logging import logging
from openlp.core.common import translate from openlp.core.common import translate
from openlp.plugins.songs.lib.songimport.songimport import SongImport from openlp.plugins.songs.lib.importers.songimport import SongImport
BLOCK_TYPES = ('V', 'C', 'B') BLOCK_TYPES = ('V', 'C', 'B')
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class WowImport(SongImport): class WordsOfWorshipImport(SongImport):
""" """
The :class:`WowImport` class provides the ability to import song files from The :class:`WowImport` class provides the ability to import song files from
Words of Worship. Words of Worship.

View File

@ -27,7 +27,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
""" """
The :mod:`worshipassistantimport` module provides the functionality for importing The :mod:`worshipassistant` module provides the functionality for importing
Worship Assistant songs into the OpenLP database. Worship Assistant songs into the OpenLP database.
""" """
import chardet import chardet
@ -37,7 +37,7 @@ import re
from openlp.core.common import translate from openlp.core.common import translate
from openlp.plugins.songs.lib import VerseType from openlp.plugins.songs.lib import VerseType
from openlp.plugins.songs.lib.songimport.songimport import SongImport from openlp.plugins.songs.lib.importers.songimport import SongImport
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View File

@ -35,7 +35,7 @@ import logging
import pyodbc import pyodbc
from openlp.core.common import translate from openlp.core.common import translate
from openlp.plugins.songs.lib.songimport.songimport import SongImport from openlp.plugins.songs.lib.importers.songimport import SongImport
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View File

@ -34,7 +34,7 @@ import csv
import logging import logging
from openlp.core.common import translate from openlp.core.common import translate
from openlp.plugins.songs.lib.songimport.songimport import SongImport from openlp.plugins.songs.lib.importers.songimport import SongImport
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View File

@ -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.db import init_schema, Song
from openlp.plugins.songs.lib.mediaitem import SongSearch from openlp.plugins.songs.lib.mediaitem import SongSearch
from openlp.plugins.songs.lib.importer import SongFormat from openlp.plugins.songs.lib.importer import SongFormat
from openlp.plugins.songs.lib.songimport.olpimport import OpenLPSongImport from openlp.plugins.songs.lib.importers.openlp import OpenLPSongImport
from openlp.plugins.songs.lib.mediaitem import SongMediaItem from openlp.plugins.songs.lib.mediaitem import SongMediaItem
from openlp.plugins.songs.lib.songstab import SongsTab from openlp.plugins.songs.lib.songstab import SongsTab

View File

@ -35,7 +35,7 @@ from unittest import TestCase
from tests.functional import MagicMock, patch from tests.functional import MagicMock, patch
from openlp.plugins.songs.lib.songimport.ewimport import EasyWorshipSongImport, FieldDescEntry, FieldType from openlp.plugins.songs.lib.importers.easyworship import EasyWorshipSongImport, FieldDescEntry, FieldType
TEST_PATH = os.path.abspath( TEST_PATH = os.path.abspath(
os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources', 'easyworshipsongs')) 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 Test creating an instance of the EasyWorship file importer
""" """
# GIVEN: A mocked out SongImport class, and a mocked out "manager" # GIVEN: A mocked out SongImport class, and a mocked out "manager"
with patch('openlp.plugins.songs.lib.songimport.ewimport.SongImport'): with patch('openlp.plugins.songs.lib.importers.easyworship.SongImport'):
mocked_manager = MagicMock() mocked_manager = MagicMock()
# WHEN: An importer object is created # 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` 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. # GIVEN: A mocked out SongImport class, a mocked out "manager" and a list of field descriptions.
with patch('openlp.plugins.songs.lib.songimport.ewimport.SongImport'): with patch('openlp.plugins.songs.lib.importers.easyworship.SongImport'):
mocked_manager = MagicMock() mocked_manager = MagicMock()
importer = EasyWorshipSongImport(mocked_manager, filenames=[]) importer = EasyWorshipSongImport(mocked_manager, filenames=[])
importer.field_descriptions = TEST_FIELD_DESCS 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` 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 # GIVEN: A mocked out SongImport class, a mocked out "manager" and a list of field descriptions
with patch('openlp.plugins.songs.lib.songimport.ewimport.SongImport'): with patch('openlp.plugins.songs.lib.importers.easyworship.SongImport'):
mocked_manager = MagicMock() mocked_manager = MagicMock()
importer = EasyWorshipSongImport(mocked_manager, filenames=[]) importer = EasyWorshipSongImport(mocked_manager, filenames=[])
importer.field_descriptions = TEST_FIELD_DESCS 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 # GIVEN: A mocked out SongImport class, a mocked out struct class, and a mocked out "manager" and a list of
# field descriptions # field descriptions
with patch('openlp.plugins.songs.lib.songimport.ewimport.SongImport'), \ with patch('openlp.plugins.songs.lib.importers.easyworship.SongImport'), \
patch('openlp.plugins.songs.lib.songimport.ewimport.struct') as mocked_struct: patch('openlp.plugins.songs.lib.importers.easyworship.struct') as mocked_struct:
mocked_manager = MagicMock() mocked_manager = MagicMock()
importer = EasyWorshipSongImport(mocked_manager, filenames=[]) importer = EasyWorshipSongImport(mocked_manager, filenames=[])
@ -246,7 +246,7 @@ class TestEasyWorshipSongImport(TestCase):
Test the :mod:`get_field` module 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 # 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.songimport.ewimport.SongImport'): with patch('openlp.plugins.songs.lib.importers.easyworship.SongImport'):
mocked_manager = MagicMock() mocked_manager = MagicMock()
importer = EasyWorshipSongImport(mocked_manager, filenames=[]) importer = EasyWorshipSongImport(mocked_manager, filenames=[])
importer.encoding = TEST_DATA_ENCODING importer.encoding = TEST_DATA_ENCODING
@ -269,7 +269,7 @@ class TestEasyWorshipSongImport(TestCase):
""" """
for test_results in GET_MEMO_FIELD_TEST_RESULTS: 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 # GIVEN: A mocked out SongImport class, a mocked out "manager", a mocked out memo_file and an encoding
with patch('openlp.plugins.songs.lib.songimport.ewimport.SongImport'): with patch('openlp.plugins.songs.lib.importers.easyworship.SongImport'):
mocked_manager = MagicMock() mocked_manager = MagicMock()
mocked_memo_file = MagicMock() mocked_memo_file = MagicMock()
importer = EasyWorshipSongImport(mocked_manager, filenames=[]) importer = EasyWorshipSongImport(mocked_manager, filenames=[])
@ -300,8 +300,8 @@ class TestEasyWorshipSongImport(TestCase):
Test the :mod:`do_import` module opens the correct files Test the :mod:`do_import` module opens the correct files
""" """
# GIVEN: A mocked out SongImport class, a mocked out "manager" # GIVEN: A mocked out SongImport class, a mocked out "manager"
with patch('openlp.plugins.songs.lib.songimport.ewimport.SongImport'), \ with patch('openlp.plugins.songs.lib.importers.easyworship.SongImport'), \
patch('openlp.plugins.songs.lib.songimport.ewimport.os.path') as mocked_os_path: patch('openlp.plugins.songs.lib.importers.easyworship.os.path') as mocked_os_path:
mocked_manager = MagicMock() mocked_manager = MagicMock()
importer = EasyWorshipSongImport(mocked_manager, filenames=[]) importer = EasyWorshipSongImport(mocked_manager, filenames=[])
mocked_os_path.isfile.side_effect = [True, False] 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. Test the :mod:`do_import` module produces an error when Songs.MB not found.
""" """
# GIVEN: A mocked out SongImport class, a mocked out "manager" # GIVEN: A mocked out SongImport class, a mocked out "manager"
with patch('openlp.plugins.songs.lib.songimport.ewimport.SongImport'), \ with patch('openlp.plugins.songs.lib.importers.easyworship.SongImport'), \
patch('openlp.plugins.songs.lib.songimport.ewimport.os.path') as mocked_os_path: patch('openlp.plugins.songs.lib.importers.easyworship.os.path') as mocked_os_path:
mocked_manager = MagicMock() mocked_manager = MagicMock()
importer = EasyWorshipSongImport(mocked_manager, filenames=[]) importer = EasyWorshipSongImport(mocked_manager, filenames=[])
importer.log_error = MagicMock() importer.log_error = MagicMock()
@ -339,8 +339,8 @@ class TestEasyWorshipSongImport(TestCase):
Test the :mod:`do_import` module handles invalid database files correctly Test the :mod:`do_import` module handles invalid database files correctly
""" """
# GIVEN: A mocked out SongImport class, os.path and a mocked out "manager" # GIVEN: A mocked out SongImport class, os.path and a mocked out "manager"
with patch('openlp.plugins.songs.lib.songimport.ewimport.SongImport'), \ with patch('openlp.plugins.songs.lib.importers.easyworship.SongImport'), \
patch('openlp.plugins.songs.lib.songimport.ewimport.os.path') as mocked_os_path: patch('openlp.plugins.songs.lib.importers.easyworship.os.path') as mocked_os_path:
mocked_manager = MagicMock() mocked_manager = MagicMock()
importer = EasyWorshipSongImport(mocked_manager, filenames=[]) importer = EasyWorshipSongImport(mocked_manager, filenames=[])
mocked_os_path.isfile.return_value = True 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 Test the :mod:`do_import` module handles invalid memo files correctly
""" """
# GIVEN: A mocked out SongImport class, a mocked out "manager" # GIVEN: A mocked out SongImport class, a mocked out "manager"
with patch('openlp.plugins.songs.lib.songimport.ewimport.SongImport'), \ with patch('openlp.plugins.songs.lib.importers.easyworship.SongImport'), \
patch('openlp.plugins.songs.lib.songimport.ewimport.os.path') as mocked_os_path, \ patch('openlp.plugins.songs.lib.importers.easyworship.os.path') as mocked_os_path, \
patch('builtins.open') as mocked_open, \ patch('builtins.open') as mocked_open, \
patch('openlp.plugins.songs.lib.songimport.ewimport.struct') as mocked_struct: patch('openlp.plugins.songs.lib.importers.easyworship.struct') as mocked_struct:
mocked_manager = MagicMock() mocked_manager = MagicMock()
importer = EasyWorshipSongImport(mocked_manager, filenames=[]) importer = EasyWorshipSongImport(mocked_manager, filenames=[])
mocked_os_path.isfile.return_value = True 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 Test the :mod:`do_import` converts the code page to the encoding correctly
""" """
# GIVEN: A mocked out SongImport class, a mocked out "manager" # GIVEN: A mocked out SongImport class, a mocked out "manager"
with patch('openlp.plugins.songs.lib.songimport.ewimport.SongImport'), \ with patch('openlp.plugins.songs.lib.importers.easyworship.SongImport'), \
patch('openlp.plugins.songs.lib.songimport.ewimport.os.path') as mocked_os_path, \ patch('openlp.plugins.songs.lib.importers.easyworship.os.path') as mocked_os_path, \
patch('builtins.open'), patch('openlp.plugins.songs.lib.songimport.ewimport.struct') as mocked_struct, \ patch('builtins.open'), patch('openlp.plugins.songs.lib.importers.easyworship.struct') as mocked_struct, \
patch('openlp.plugins.songs.lib.songimport.ewimport.retrieve_windows_encoding') as \ patch('openlp.plugins.songs.lib.importers.easyworship.retrieve_windows_encoding') as \
mocked_retrieve_windows_encoding: mocked_retrieve_windows_encoding:
mocked_manager = MagicMock() mocked_manager = MagicMock()
importer = EasyWorshipSongImport(mocked_manager, filenames=[]) 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", # 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. # and mocked out "author", "add_copyright", "add_verse", "finish" methods.
with patch('openlp.plugins.songs.lib.songimport.ewimport.SongImport'), \ with patch('openlp.plugins.songs.lib.importers.easyworship.SongImport'), \
patch('openlp.plugins.songs.lib.songimport.ewimport.retrieve_windows_encoding') as \ patch('openlp.plugins.songs.lib.importers.easyworship.retrieve_windows_encoding') as \
mocked_retrieve_windows_encoding: mocked_retrieve_windows_encoding:
mocked_retrieve_windows_encoding.return_value = 'cp1252' mocked_retrieve_windows_encoding.return_value = 'cp1252'
mocked_manager = MagicMock() 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", # 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. # and mocked out "author", "add_copyright", "add_verse", "finish" methods.
with patch('openlp.plugins.songs.lib.songimport.ewimport.SongImport'), \ with patch('openlp.plugins.songs.lib.importers.easyworship.SongImport'), \
patch('openlp.plugins.songs.lib.songimport.ewimport.retrieve_windows_encoding') \ patch('openlp.plugins.songs.lib.importers.easyworship.retrieve_windows_encoding') \
as mocked_retrieve_windows_encoding: as mocked_retrieve_windows_encoding:
mocked_retrieve_windows_encoding.return_value = 'cp1252' mocked_retrieve_windows_encoding.return_value = 'cp1252'
mocked_manager = MagicMock() 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. # GIVEN: A mocked out SongImport class, a mocked out "manager" and mocked out "author" method.
with patch('openlp.plugins.songs.lib.songimport.ewimport.SongImport'): with patch('openlp.plugins.songs.lib.importers.easyworship.SongImport'):
mocked_manager = MagicMock() mocked_manager = MagicMock()
mocked_add_author = MagicMock() mocked_add_author = MagicMock()
importer = EasyWorshipSongImportLogger(mocked_manager) importer = EasyWorshipSongImportLogger(mocked_manager)

View File

@ -34,7 +34,7 @@ import os
from unittest import TestCase from unittest import TestCase
from tests.functional import patch, MagicMock from tests.functional import patch, MagicMock
from openlp.plugins.songs.lib.songimport.foilpresenterimport import FoilPresenter from openlp.plugins.songs.lib.importers.foilpresenter import FoilPresenter
TEST_PATH = os.path.abspath( TEST_PATH = os.path.abspath(
os.path.join(os.path.dirname(__file__), '..', '..', '..', '/resources/foilpresentersongs')) os.path.join(os.path.dirname(__file__), '..', '..', '..', '/resources/foilpresentersongs'))
@ -57,27 +57,27 @@ class TestFoilPresenter(TestCase):
# _process_topics # _process_topics
def setUp(self): def setUp(self):
self.child_patcher = patch('openlp.plugins.songs.lib.songimport.foilpresenterimport.FoilPresenter._child') self.child_patcher = patch('openlp.plugins.songs.lib.importers.foilpresenter.FoilPresenter._child')
self.clean_song_patcher = patch('openlp.plugins.songs.lib.songimport.foilpresenterimport.clean_song') self.clean_song_patcher = patch('openlp.plugins.songs.lib.importers.foilpresenter.clean_song')
self.objectify_patcher = patch('openlp.plugins.songs.lib.songimport.foilpresenterimport.objectify') self.objectify_patcher = patch('openlp.plugins.songs.lib.importers.foilpresenter.objectify')
self.process_authors_patcher = \ self.process_authors_patcher = \
patch('openlp.plugins.songs.lib.songimport.foilpresenterimport.FoilPresenter._process_authors') patch('openlp.plugins.songs.lib.importers.foilpresenter.FoilPresenter._process_authors')
self.process_cclinumber_patcher = \ self.process_cclinumber_patcher = \
patch('openlp.plugins.songs.lib.songimport.foilpresenterimport.FoilPresenter._process_cclinumber') patch('openlp.plugins.songs.lib.importers.foilpresenter.FoilPresenter._process_cclinumber')
self.process_comments_patcher = \ self.process_comments_patcher = \
patch('openlp.plugins.songs.lib.songimport.foilpresenterimport.FoilPresenter._process_comments') patch('openlp.plugins.songs.lib.importers.foilpresenter.FoilPresenter._process_comments')
self.process_lyrics_patcher = \ self.process_lyrics_patcher = \
patch('openlp.plugins.songs.lib.songimport.foilpresenterimport.FoilPresenter._process_lyrics') patch('openlp.plugins.songs.lib.importers.foilpresenter.FoilPresenter._process_lyrics')
self.process_songbooks_patcher = \ self.process_songbooks_patcher = \
patch('openlp.plugins.songs.lib.songimport.foilpresenterimport.FoilPresenter._process_songbooks') patch('openlp.plugins.songs.lib.importers.foilpresenter.FoilPresenter._process_songbooks')
self.process_titles_patcher = \ self.process_titles_patcher = \
patch('openlp.plugins.songs.lib.songimport.foilpresenterimport.FoilPresenter._process_titles') patch('openlp.plugins.songs.lib.importers.foilpresenter.FoilPresenter._process_titles')
self.process_topics_patcher = \ self.process_topics_patcher = \
patch('openlp.plugins.songs.lib.songimport.foilpresenterimport.FoilPresenter._process_topics') patch('openlp.plugins.songs.lib.importers.foilpresenter.FoilPresenter._process_topics')
self.re_patcher = patch('openlp.plugins.songs.lib.songimport.foilpresenterimport.re') self.re_patcher = patch('openlp.plugins.songs.lib.importers.foilpresenter.re')
self.song_patcher = patch('openlp.plugins.songs.lib.songimport.foilpresenterimport.Song') self.song_patcher = patch('openlp.plugins.songs.lib.importers.foilpresenter.Song')
self.song_xml_patcher = patch('openlp.plugins.songs.lib.songimport.foilpresenterimport.SongXML') self.song_xml_patcher = patch('openlp.plugins.songs.lib.importers.foilpresenter.SongXML')
self.translate_patcher = patch('openlp.plugins.songs.lib.songimport.foilpresenterimport.translate') self.translate_patcher = patch('openlp.plugins.songs.lib.importers.foilpresenter.translate')
self.mocked_child = self.child_patcher.start() self.mocked_child = self.child_patcher.start()
self.mocked_clean_song = self.clean_song_patcher.start() self.mocked_clean_song = self.clean_song_patcher.start()

View File

@ -34,8 +34,8 @@ import os
from unittest import TestCase from unittest import TestCase
from tests.functional import MagicMock, patch from tests.functional import MagicMock, patch
from openlp.plugins.songs.lib.songimport.openlyricsimport import OpenLyricsImport from openlp.plugins.songs.lib.importers.openlyrics import OpenLyricsImport
from openlp.plugins.songs.lib.songimport.songimport import SongImport from openlp.plugins.songs.lib.importers.songimport import SongImport
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'))
@ -69,7 +69,7 @@ class TestOpenLyricsImport(TestCase):
Test creating an instance of the OpenLyrics file importer Test creating an instance of the OpenLyrics file importer
""" """
# GIVEN: A mocked out SongImport class, and a mocked out "manager" # GIVEN: A mocked out SongImport class, and a mocked out "manager"
with patch('openlp.plugins.songs.lib.songimport.openlyricsimport.SongImport'): with patch('openlp.plugins.songs.lib.importers.openlyrics.SongImport'):
mocked_manager = MagicMock() mocked_manager = MagicMock()
# WHEN: An importer object is created # WHEN: An importer object is created

View File

@ -34,7 +34,7 @@ import os
from unittest import TestCase from unittest import TestCase
from tests.helpers.songfileimport import SongImportTestHelper from tests.helpers.songfileimport import SongImportTestHelper
from openlp.plugins.songs.lib.songimport.opensongimport import OpenSongImport from openlp.plugins.songs.lib.importers.opensong import OpenSongImport
from tests.functional import patch, MagicMock from tests.functional import patch, MagicMock
TEST_PATH = os.path.abspath( TEST_PATH = os.path.abspath(
@ -45,7 +45,7 @@ class TestOpenSongFileImport(SongImportTestHelper):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.importer_class_name = 'OpenSongImport' self.importer_class_name = 'OpenSongImport'
self.importer_module_name = 'opensongimport' self.importer_module_name = 'opensong'
super(TestOpenSongFileImport, self).__init__(*args, **kwargs) super(TestOpenSongFileImport, self).__init__(*args, **kwargs)
def test_song_import(self): def test_song_import(self):
@ -69,7 +69,7 @@ class TestOpenSongImport(TestCase):
Test creating an instance of the OpenSong file importer Test creating an instance of the OpenSong file importer
""" """
# GIVEN: A mocked out SongImport class, and a mocked out "manager" # GIVEN: A mocked out SongImport class, and a mocked out "manager"
with patch('openlp.plugins.songs.lib.songimport.opensongimport.SongImport'): with patch('openlp.plugins.songs.lib.importers.opensong.SongImport'):
mocked_manager = MagicMock() mocked_manager = MagicMock()
# WHEN: An importer object is created # WHEN: An importer object is created
@ -83,7 +83,7 @@ class TestOpenSongImport(TestCase):
Test OpenSongImport.do_import handles different invalid import_source values Test OpenSongImport.do_import handles different invalid import_source values
""" """
# GIVEN: A mocked out SongImport class, and a mocked out "manager" # GIVEN: A mocked out SongImport class, and a mocked out "manager"
with patch('openlp.plugins.songs.lib.songimport.opensongimport.SongImport'): with patch('openlp.plugins.songs.lib.importers.opensong.SongImport'):
mocked_manager = MagicMock() mocked_manager = MagicMock()
mocked_import_wizard = MagicMock() mocked_import_wizard = MagicMock()
importer = OpenSongImport(mocked_manager, filenames=[]) importer = OpenSongImport(mocked_manager, filenames=[])
@ -104,7 +104,7 @@ class TestOpenSongImport(TestCase):
Test OpenSongImport.do_import handles different invalid import_source values Test OpenSongImport.do_import handles different invalid import_source values
""" """
# GIVEN: A mocked out SongImport class, and a mocked out "manager" # GIVEN: A mocked out SongImport class, and a mocked out "manager"
with patch('openlp.plugins.songs.lib.songimport.opensongimport.SongImport'): with patch('openlp.plugins.songs.lib.importers.opensong.SongImport'):
mocked_manager = MagicMock() mocked_manager = MagicMock()
mocked_import_wizard = MagicMock() mocked_import_wizard = MagicMock()
importer = OpenSongImport(mocked_manager, filenames=[]) importer = OpenSongImport(mocked_manager, filenames=[])

View File

@ -43,7 +43,7 @@ class TestProPresenterFileImport(SongImportTestHelper):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.importer_class_name = 'ProPresenterImport' self.importer_class_name = 'ProPresenterImport'
self.importer_module_name = 'propresenterimport' self.importer_module_name = 'propresenter'
super(TestProPresenterFileImport, self).__init__(*args, **kwargs) super(TestProPresenterFileImport, self).__init__(*args, **kwargs)
def test_song_import(self): def test_song_import(self):

View File

@ -34,7 +34,7 @@ import os
from unittest import TestCase from unittest import TestCase
from tests.functional import MagicMock, patch from tests.functional import MagicMock, patch
from openlp.plugins.songs.lib.songimport.songbeamerimport import SongBeamerImport from openlp.plugins.songs.lib.importers.songbeamer import SongBeamerImport
from openlp.plugins.songs.lib import VerseType from openlp.plugins.songs.lib import VerseType
TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), 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 Test creating an instance of the SongBeamer file importer
""" """
# GIVEN: A mocked out SongImport class, and a mocked out "manager" # GIVEN: A mocked out SongImport class, and a mocked out "manager"
with patch('openlp.plugins.songs.lib.songimport.songbeamerimport.SongImport'): with patch('openlp.plugins.songs.lib.importers.songbeamer.SongImport'):
mocked_manager = MagicMock() mocked_manager = MagicMock()
# WHEN: An importer object is created # WHEN: An importer object is created
@ -78,7 +78,7 @@ class TestSongBeamerImport(TestCase):
Test SongBeamerImport.do_import handles different invalid import_source values Test SongBeamerImport.do_import handles different invalid import_source values
""" """
# GIVEN: A mocked out SongImport class, and a mocked out "manager" # GIVEN: A mocked out SongImport class, and a mocked out "manager"
with patch('openlp.plugins.songs.lib.songimport.songbeamerimport.SongImport'): with patch('openlp.plugins.songs.lib.importers.songbeamer.SongImport'):
mocked_manager = MagicMock() mocked_manager = MagicMock()
mocked_import_wizard = MagicMock() mocked_import_wizard = MagicMock()
importer = SongBeamerImport(mocked_manager, filenames=[]) importer = SongBeamerImport(mocked_manager, filenames=[])
@ -99,7 +99,7 @@ class TestSongBeamerImport(TestCase):
Test SongBeamerImport.do_import handles different invalid import_source values Test SongBeamerImport.do_import handles different invalid import_source values
""" """
# GIVEN: A mocked out SongImport class, and a mocked out "manager" # GIVEN: A mocked out SongImport class, and a mocked out "manager"
with patch('openlp.plugins.songs.lib.songimport.songbeamerimport.SongImport'): with patch('openlp.plugins.songs.lib.importers.songbeamer.SongImport'):
mocked_manager = MagicMock() mocked_manager = MagicMock()
mocked_import_wizard = MagicMock() mocked_import_wizard = MagicMock()
importer = SongBeamerImport(mocked_manager, filenames=[]) 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", # 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. # and mocked out "author", "add_copyright", "add_verse", "finish" methods.
with patch('openlp.plugins.songs.lib.songimport.songbeamerimport.SongImport'): with patch('openlp.plugins.songs.lib.importers.songbeamer.SongImport'):
for song_file in SONG_TEST_DATA: for song_file in SONG_TEST_DATA:
mocked_manager = MagicMock() mocked_manager = MagicMock()
mocked_import_wizard = MagicMock() mocked_import_wizard = MagicMock()

View File

@ -35,7 +35,7 @@ from unittest import TestCase
from tests.helpers.songfileimport import SongImportTestHelper 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.songimport.songshowplusimport import SongShowPlusImport from openlp.plugins.songs.lib.importers.songshowplus import SongShowPlusImport
from tests.functional import patch, MagicMock from tests.functional import patch, MagicMock
TEST_PATH = os.path.abspath( TEST_PATH = os.path.abspath(
@ -46,7 +46,7 @@ class TestSongShowPlusFileImport(SongImportTestHelper):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.importer_class_name = 'SongShowPlusImport' self.importer_class_name = 'SongShowPlusImport'
self.importer_module_name = 'songshowplusimport' self.importer_module_name = 'songshowplus'
super(TestSongShowPlusFileImport, self).__init__(*args, **kwargs) super(TestSongShowPlusFileImport, self).__init__(*args, **kwargs)
def test_song_import(self): def test_song_import(self):
@ -70,7 +70,7 @@ class TestSongShowPlusImport(TestCase):
Test creating an instance of the SongShow Plus file importer Test creating an instance of the SongShow Plus file importer
""" """
# GIVEN: A mocked out SongImport class, and a mocked out "manager" # GIVEN: A mocked out SongImport class, and a mocked out "manager"
with patch('openlp.plugins.songs.lib.songimport.songshowplusimport.SongImport'): with patch('openlp.plugins.songs.lib.importers.songshowplus.SongImport'):
mocked_manager = MagicMock() mocked_manager = MagicMock()
# WHEN: An importer object is created # WHEN: An importer object is created
@ -84,7 +84,7 @@ class TestSongShowPlusImport(TestCase):
Test SongShowPlusImport.do_import handles different invalid import_source values Test SongShowPlusImport.do_import handles different invalid import_source values
""" """
# GIVEN: A mocked out SongImport class, and a mocked out "manager" # GIVEN: A mocked out SongImport class, and a mocked out "manager"
with patch('openlp.plugins.songs.lib.songimport.songshowplusimport.SongImport'): with patch('openlp.plugins.songs.lib.importers.songshowplus.SongImport'):
mocked_manager = MagicMock() mocked_manager = MagicMock()
mocked_import_wizard = MagicMock() mocked_import_wizard = MagicMock()
importer = SongShowPlusImport(mocked_manager, filenames=[]) importer = SongShowPlusImport(mocked_manager, filenames=[])
@ -105,7 +105,7 @@ class TestSongShowPlusImport(TestCase):
Test SongShowPlusImport.do_import handles different invalid import_source values Test SongShowPlusImport.do_import handles different invalid import_source values
""" """
# GIVEN: A mocked out SongImport class, and a mocked out "manager" # GIVEN: A mocked out SongImport class, and a mocked out "manager"
with patch('openlp.plugins.songs.lib.songimport.songshowplusimport.SongImport'): with patch('openlp.plugins.songs.lib.importers.songshowplus.SongImport'):
mocked_manager = MagicMock() mocked_manager = MagicMock()
mocked_import_wizard = MagicMock() mocked_import_wizard = MagicMock()
importer = SongShowPlusImport(mocked_manager, filenames=[]) importer = SongShowPlusImport(mocked_manager, filenames=[])
@ -126,7 +126,7 @@ class TestSongShowPlusImport(TestCase):
Test to_openlp_verse_tag method by simulating adding a verse Test to_openlp_verse_tag method by simulating adding a verse
""" """
# GIVEN: A mocked out SongImport class, and a mocked out "manager" # GIVEN: A mocked out SongImport class, and a mocked out "manager"
with patch('openlp.plugins.songs.lib.songimport.songshowplusimport.SongImport'): with patch('openlp.plugins.songs.lib.importers.songshowplus.SongImport'):
mocked_manager = MagicMock() mocked_manager = MagicMock()
importer = SongShowPlusImport(mocked_manager, filenames=[]) 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 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" # GIVEN: A mocked out SongImport class, and a mocked out "manager"
with patch('openlp.plugins.songs.lib.songimport.songshowplusimport.SongImport'): with patch('openlp.plugins.songs.lib.importers.songshowplus.SongImport'):
mocked_manager = MagicMock() mocked_manager = MagicMock()
importer = SongShowPlusImport(mocked_manager, filenames=[]) importer = SongShowPlusImport(mocked_manager, filenames=[])

View File

@ -43,7 +43,7 @@ class TestWorshipAssistantFileImport(SongImportTestHelper):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.importer_class_name = 'WorshipAssistantImport' self.importer_class_name = 'WorshipAssistantImport'
self.importer_module_name = 'worshipassistantimport' self.importer_module_name = 'worshipassistant'
super(TestWorshipAssistantFileImport, self).__init__(*args, **kwargs) super(TestWorshipAssistantFileImport, self).__init__(*args, **kwargs)
def test_song_import(self): def test_song_import(self):

View File

@ -37,7 +37,7 @@ if os.name != 'nt':
import pyodbc import pyodbc
from openlp.plugins.songs.lib.songimport.worshipcenterproimport import WorshipCenterProImport from openlp.plugins.songs.lib.importers.worshipcenterpro import WorshipCenterProImport
from tests.functional import patch, MagicMock from tests.functional import patch, MagicMock
@ -141,7 +141,7 @@ class TestWorshipCenterProSongImport(TestCase):
Test creating an instance of the WorshipCenter Pro file importer Test creating an instance of the WorshipCenter Pro file importer
""" """
# GIVEN: A mocked out SongImport class, and a mocked out "manager" # GIVEN: A mocked out SongImport class, and a mocked out "manager"
with patch('openlp.plugins.songs.lib.songimport.worshipcenterproimport.SongImport'): with patch('openlp.plugins.songs.lib.importers.worshipcenterpro.SongImport'):
mocked_manager = MagicMock() mocked_manager = MagicMock()
# WHEN: An importer object is created # WHEN: An importer object is created
@ -156,10 +156,10 @@ class TestWorshipCenterProSongImport(TestCase):
""" """
# GIVEN: A mocked out SongImport class, a mocked out pyodbc module, a mocked out translate method, # GIVEN: A mocked out SongImport class, a mocked out pyodbc module, a mocked out translate method,
# a mocked "manager" and a mocked out log_error method. # a mocked "manager" and a mocked out log_error method.
with patch('openlp.plugins.songs.lib.songimport.worshipcenterproimport.SongImport'), \ with patch('openlp.plugins.songs.lib.importers.worshipcenterpro.SongImport'), \
patch('openlp.plugins.songs.lib.songimport.worshipcenterproimport.pyodbc.connect') \ patch('openlp.plugins.songs.lib.importers.worshipcenterpro.pyodbc.connect') \
as mocked_pyodbc_connect, \ as mocked_pyodbc_connect, \
patch('openlp.plugins.songs.lib.songimport.worshipcenterproimport.translate') as mocked_translate: patch('openlp.plugins.songs.lib.importers.worshipcenterpro.translate') as mocked_translate:
mocked_manager = MagicMock() mocked_manager = MagicMock()
mocked_log_error = MagicMock() mocked_log_error = MagicMock()
mocked_translate.return_value = 'Translated Text' mocked_translate.return_value = 'Translated Text'
@ -186,9 +186,9 @@ class TestWorshipCenterProSongImport(TestCase):
""" """
# GIVEN: A mocked out SongImport class, a mocked out pyodbc module with a simulated recordset, a mocked out # GIVEN: A mocked out SongImport class, a mocked out pyodbc module with a simulated recordset, a mocked out
# translate method, a mocked "manager", add_verse method & mocked_finish method. # translate method, a mocked "manager", add_verse method & mocked_finish method.
with patch('openlp.plugins.songs.lib.songimport.worshipcenterproimport.SongImport'), \ with patch('openlp.plugins.songs.lib.importers.worshipcenterpro.SongImport'), \
patch('openlp.plugins.songs.lib.songimport.worshipcenterproimport.pyodbc') as mocked_pyodbc, \ patch('openlp.plugins.songs.lib.importers.worshipcenterpro.pyodbc') as mocked_pyodbc, \
patch('openlp.plugins.songs.lib.songimport.worshipcenterproimport.translate') as mocked_translate: patch('openlp.plugins.songs.lib.importers.worshipcenterpro.translate') as mocked_translate:
mocked_manager = MagicMock() mocked_manager = MagicMock()
mocked_import_wizard = MagicMock() mocked_import_wizard = MagicMock()
mocked_add_verse = MagicMock() mocked_add_verse = MagicMock()

View File

@ -33,8 +33,8 @@ This module contains tests for the ZionWorx song importer.
from unittest import TestCase from unittest import TestCase
from tests.functional import MagicMock, patch from tests.functional import MagicMock, patch
from openlp.plugins.songs.lib.songimport.zionworximport import ZionWorxImport from openlp.plugins.songs.lib.importers.zionworx import ZionWorxImport
from openlp.plugins.songs.lib.songimport.songimport import SongImport from openlp.plugins.songs.lib.importers.songimport import SongImport
class TestZionWorxImport(TestCase): class TestZionWorxImport(TestCase):
@ -46,7 +46,7 @@ class TestZionWorxImport(TestCase):
Test creating an instance of the ZionWorx file importer Test creating an instance of the ZionWorx file importer
""" """
# GIVEN: A mocked out SongImport class, and a mocked out "manager" # GIVEN: A mocked out SongImport class, and a mocked out "manager"
with patch('openlp.plugins.songs.lib.songimport.zionworximport.SongImport'): with patch('openlp.plugins.songs.lib.importers.zionworx.SongImport'):
mocked_manager = MagicMock() mocked_manager = MagicMock()
# WHEN: An importer object is created # WHEN: An importer object is created

View File

@ -43,7 +43,7 @@ class SongImportTestHelper(TestCase):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(SongImportTestHelper, self).__init__(*args, **kwargs) super(SongImportTestHelper, self).__init__(*args, **kwargs)
self.importer_module = __import__( self.importer_module = __import__(
'openlp.plugins.songs.lib.songimport.%s' % self.importer_module_name, fromlist=[self.importer_class_name]) 'openlp.plugins.songs.lib.importers.%s' % self.importer_module_name, fromlist=[self.importer_class_name])
self.importer_class = getattr(self.importer_module, self.importer_class_name) self.importer_class = getattr(self.importer_module, self.importer_class_name)
def setUp(self): def setUp(self):
@ -51,17 +51,17 @@ class SongImportTestHelper(TestCase):
Patch and set up the mocks required. Patch and set up the mocks required.
""" """
self.add_copyright_patcher = patch( self.add_copyright_patcher = patch(
'openlp.plugins.songs.lib.songimport.%s.%s.add_copyright' % (self.importer_module_name, 'openlp.plugins.songs.lib.importers.%s.%s.add_copyright' % (self.importer_module_name,
self.importer_class_name)) self.importer_class_name))
self.add_verse_patcher = patch( self.add_verse_patcher = patch(
'openlp.plugins.songs.lib.songimport.%s.%s.add_verse' % (self.importer_module_name, 'openlp.plugins.songs.lib.importers.%s.%s.add_verse' % (self.importer_module_name,
self.importer_class_name)) self.importer_class_name))
self.finish_patcher = patch( self.finish_patcher = patch(
'openlp.plugins.songs.lib.songimport.%s.%s.finish' % (self.importer_module_name, self.importer_class_name)) 'openlp.plugins.songs.lib.importers.%s.%s.finish' % (self.importer_module_name, self.importer_class_name))
self.add_author_patcher = patch( self.add_author_patcher = patch(
'openlp.plugins.songs.lib.songimport.%s.%s.add_author' % (self.importer_module_name, 'openlp.plugins.songs.lib.importers.%s.%s.add_author' % (self.importer_module_name,
self.importer_class_name)) self.importer_class_name))
self.song_import_patcher = patch('openlp.plugins.songs.lib.songimport.%s.SongImport' % self.song_import_patcher = patch('openlp.plugins.songs.lib.importers.%s.SongImport' %
self.importer_module_name) self.importer_module_name)
self.mocked_add_copyright = self.add_copyright_patcher.start() self.mocked_add_copyright = self.add_copyright_patcher.start()
self.mocked_add_verse = self.add_verse_patcher.start() self.mocked_add_verse = self.add_verse_patcher.start()