forked from openlp/openlp
Merge branch 'tests_plugin_4' into 'master'
Tests plugin 4 See merge request openlp/openlp!154
This commit is contained in:
commit
da4a3570f3
@ -26,9 +26,10 @@ from tempfile import mkdtemp
|
|||||||
from unittest import TestCase, skipIf, SkipTest
|
from unittest import TestCase, skipIf, SkipTest
|
||||||
from unittest.mock import MagicMock, patch, call
|
from unittest.mock import MagicMock, patch, call
|
||||||
|
|
||||||
from openlp.core.common.registry import Registry
|
|
||||||
from openlp.core.common import is_macosx
|
from openlp.core.common import is_macosx
|
||||||
from openlp.core.common.path import Path
|
from openlp.core.common.path import Path
|
||||||
|
from openlp.core.common.registry import Registry
|
||||||
|
from openlp.core.common.settings import Settings
|
||||||
from openlp.plugins.presentations.lib.maclocontroller import MacLOController, MacLODocument
|
from openlp.plugins.presentations.lib.maclocontroller import MacLOController, MacLODocument
|
||||||
|
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
@ -55,7 +56,7 @@ class TestMacLOController(TestCase, TestMixin):
|
|||||||
Registry.create()
|
Registry.create()
|
||||||
self.setup_application()
|
self.setup_application()
|
||||||
self.build_settings()
|
self.build_settings()
|
||||||
Registry().register('settings', self.settings)
|
Registry().register('settings', Settings())
|
||||||
self.mock_plugin = MagicMock()
|
self.mock_plugin = MagicMock()
|
||||||
self.temp_folder = mkdtemp()
|
self.temp_folder = mkdtemp()
|
||||||
self.mock_plugin.settings_section = self.temp_folder
|
self.mock_plugin.settings_section = self.temp_folder
|
||||||
@ -159,6 +160,8 @@ class TestMacLODocument(TestCase):
|
|||||||
Test the MacLODocument Class
|
Test the MacLODocument Class
|
||||||
"""
|
"""
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
Registry().create()
|
||||||
|
Registry().register('settings', Settings())
|
||||||
mocked_plugin = MagicMock()
|
mocked_plugin = MagicMock()
|
||||||
mocked_plugin.settings_section = 'presentations'
|
mocked_plugin.settings_section = 'presentations'
|
||||||
self.file_name = Path(TEST_RESOURCES_PATH) / 'presentations' / 'test.odp'
|
self.file_name = Path(TEST_RESOURCES_PATH) / 'presentations' / 'test.odp'
|
||||||
|
@ -55,7 +55,7 @@ def test_constructor(settings, mock_plugin):
|
|||||||
assert 'Powerpoint' == controller.name, 'The name of the presentation controller should be correct'
|
assert 'Powerpoint' == controller.name, 'The name of the presentation controller should be correct'
|
||||||
|
|
||||||
|
|
||||||
def test_show_error_msg():
|
def test_show_error_msg(get_thumbnail_folder):
|
||||||
"""
|
"""
|
||||||
Test the PowerpointDocument.show_error_msg() method gets called on com exception
|
Test the PowerpointDocument.show_error_msg() method gets called on com exception
|
||||||
"""
|
"""
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
"""
|
"""
|
||||||
This module contains tests for the OpenSong song importer.
|
This module contains tests for the OpenSong song importer.
|
||||||
"""
|
"""
|
||||||
|
from openlp.core.common.registry import Registry
|
||||||
from tests.helpers.songfileimport import SongImportTestHelper
|
from tests.helpers.songfileimport import SongImportTestHelper
|
||||||
from tests.utils.constants import RESOURCE_PATH
|
from tests.utils.constants import RESOURCE_PATH
|
||||||
|
|
||||||
@ -28,19 +29,27 @@ from tests.utils.constants import RESOURCE_PATH
|
|||||||
TEST_PATH = RESOURCE_PATH / 'songs' / 'chordpro'
|
TEST_PATH = RESOURCE_PATH / 'songs' / 'chordpro'
|
||||||
|
|
||||||
|
|
||||||
|
def test_chordpro(mock_settings):
|
||||||
|
|
||||||
class TestChordProFileImport(SongImportTestHelper):
|
class TestChordProFileImport(SongImportTestHelper):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.importer_class_name = 'ChordProImport'
|
self.importer_class_name = 'ChordProImport'
|
||||||
self.importer_module_name = 'chordpro'
|
self.importer_module_name = 'chordpro'
|
||||||
super(TestChordProFileImport, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def test_song_import(self):
|
def test_song_import(self):
|
||||||
"""
|
"""
|
||||||
Test that loading an ChordPro file works correctly on various files
|
Test that loading an ChordPro file works correctly on various files
|
||||||
"""
|
"""
|
||||||
# Mock out the settings - always return False
|
# Mock out the settings - always return False
|
||||||
self.settings.value.side_effect = lambda value: True if value == 'songs/enable chords' else False
|
Registry().get('settings').value.side_effect = lambda value: True \
|
||||||
|
if value == 'songs/enable chords' else False
|
||||||
# Do the test import
|
# Do the test import
|
||||||
self.file_import([TEST_PATH / 'swing-low.chordpro'],
|
self.file_import([TEST_PATH / 'swing-low.chordpro'],
|
||||||
self.load_external_result_data(TEST_PATH / 'swing-low.json'))
|
self.load_external_result_data(TEST_PATH / 'swing-low.json'))
|
||||||
|
|
||||||
|
test_file_import = TestChordProFileImport()
|
||||||
|
test_file_import.setUp()
|
||||||
|
test_file_import.test_song_import()
|
||||||
|
test_file_import.tearDown()
|
||||||
|
@ -28,12 +28,14 @@ from tests.utils.constants import RESOURCE_PATH
|
|||||||
TEST_PATH = RESOURCE_PATH / 'songs' / 'easyslides'
|
TEST_PATH = RESOURCE_PATH / 'songs' / 'easyslides'
|
||||||
|
|
||||||
|
|
||||||
|
def test_easyslides(mock_settings):
|
||||||
|
|
||||||
class TestEasySlidesFileImport(SongImportTestHelper):
|
class TestEasySlidesFileImport(SongImportTestHelper):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.importer_class_name = 'EasySlidesImport'
|
self.importer_class_name = 'EasySlidesImport'
|
||||||
self.importer_module_name = 'easyslides'
|
self.importer_module_name = 'easyslides'
|
||||||
super(TestEasySlidesFileImport, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def test_song_import(self):
|
def test_song_import(self):
|
||||||
"""
|
"""
|
||||||
@ -43,3 +45,8 @@ class TestEasySlidesFileImport(SongImportTestHelper):
|
|||||||
self.load_external_result_data(TEST_PATH / 'Amazing Grace.json'))
|
self.load_external_result_data(TEST_PATH / 'Amazing Grace.json'))
|
||||||
self.file_import(TEST_PATH / 'Export_2017-01-12_BB.xml',
|
self.file_import(TEST_PATH / 'Export_2017-01-12_BB.xml',
|
||||||
self.load_external_result_data(TEST_PATH / 'Export_2017-01-12_BB.json'))
|
self.load_external_result_data(TEST_PATH / 'Export_2017-01-12_BB.json'))
|
||||||
|
|
||||||
|
test_file_import = TestEasySlidesFileImport()
|
||||||
|
test_file_import.setUp()
|
||||||
|
test_file_import.test_song_import()
|
||||||
|
test_file_import.tearDown()
|
||||||
|
@ -28,6 +28,8 @@ from tests.utils.constants import RESOURCE_PATH
|
|||||||
TEST_PATH = RESOURCE_PATH / 'songs' / 'lyrix'
|
TEST_PATH = RESOURCE_PATH / 'songs' / 'lyrix'
|
||||||
|
|
||||||
|
|
||||||
|
def test_Lyrix(mock_settings):
|
||||||
|
|
||||||
class TestLyrixFileImport(SongImportTestHelper):
|
class TestLyrixFileImport(SongImportTestHelper):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
@ -45,3 +47,8 @@ class TestLyrixFileImport(SongImportTestHelper):
|
|||||||
self.load_external_result_data(TEST_PATH / 'Amazing Grace2.json'))
|
self.load_external_result_data(TEST_PATH / 'Amazing Grace2.json'))
|
||||||
self.file_import([TEST_PATH / 'AO05.TXT'],
|
self.file_import([TEST_PATH / 'AO05.TXT'],
|
||||||
self.load_external_result_data(TEST_PATH / 'in die regterhand.json'))
|
self.load_external_result_data(TEST_PATH / 'in die regterhand.json'))
|
||||||
|
|
||||||
|
test_file_import = TestLyrixFileImport()
|
||||||
|
test_file_import.setUp()
|
||||||
|
test_file_import.test_song_import()
|
||||||
|
test_file_import.tearDown()
|
||||||
|
@ -29,6 +29,8 @@ from tests.utils.constants import RESOURCE_PATH
|
|||||||
TEST_PATH = RESOURCE_PATH / 'songs' / 'powerpraise'
|
TEST_PATH = RESOURCE_PATH / 'songs' / 'powerpraise'
|
||||||
|
|
||||||
|
|
||||||
|
def test_power_praise(mock_settings):
|
||||||
|
|
||||||
class TestPowerPraiseFileImport(SongImportTestHelper):
|
class TestPowerPraiseFileImport(SongImportTestHelper):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
@ -44,3 +46,8 @@ class TestPowerPraiseFileImport(SongImportTestHelper):
|
|||||||
self.load_external_result_data(TEST_PATH / 'Naher, mein Gott zu Dir.json'))
|
self.load_external_result_data(TEST_PATH / 'Naher, mein Gott zu Dir.json'))
|
||||||
self.file_import([TEST_PATH / 'You are so faithful.ppl'],
|
self.file_import([TEST_PATH / 'You are so faithful.ppl'],
|
||||||
self.load_external_result_data(TEST_PATH / 'You are so faithful.json'))
|
self.load_external_result_data(TEST_PATH / 'You are so faithful.json'))
|
||||||
|
|
||||||
|
test_file_import = TestPowerPraiseFileImport()
|
||||||
|
test_file_import.setUp()
|
||||||
|
test_file_import.test_song_import()
|
||||||
|
test_file_import.tearDown()
|
||||||
|
@ -31,6 +31,8 @@ from tests.utils.constants import RESOURCE_PATH
|
|||||||
TEST_PATH = RESOURCE_PATH / 'songs' / 'presentationmanager'
|
TEST_PATH = RESOURCE_PATH / 'songs' / 'presentationmanager'
|
||||||
|
|
||||||
|
|
||||||
|
def test_presenter_manager(mock_settings):
|
||||||
|
|
||||||
class TestPresentationManagerFileImport(SongImportTestHelper):
|
class TestPresentationManagerFileImport(SongImportTestHelper):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
@ -47,3 +49,8 @@ class TestPresentationManagerFileImport(SongImportTestHelper):
|
|||||||
self.load_external_result_data(TEST_PATH / 'Great Is Thy Faithfulness.json'))
|
self.load_external_result_data(TEST_PATH / 'Great Is Thy Faithfulness.json'))
|
||||||
self.file_import([TEST_PATH / 'Amazing Grace.sng'],
|
self.file_import([TEST_PATH / 'Amazing Grace.sng'],
|
||||||
self.load_external_result_data(TEST_PATH / 'Amazing Grace.json'))
|
self.load_external_result_data(TEST_PATH / 'Amazing Grace.json'))
|
||||||
|
|
||||||
|
test_file_import = TestPresentationManagerFileImport()
|
||||||
|
test_file_import.setUp()
|
||||||
|
test_file_import.test_song_import()
|
||||||
|
test_file_import.tearDown()
|
||||||
|
@ -29,6 +29,8 @@ from tests.utils.constants import RESOURCE_PATH
|
|||||||
TEST_PATH = RESOURCE_PATH / 'songs' / 'songpro'
|
TEST_PATH = RESOURCE_PATH / 'songs' / 'songpro'
|
||||||
|
|
||||||
|
|
||||||
|
def test_song_pro(mock_settings):
|
||||||
|
|
||||||
class TestSongProFileImport(SongImportTestHelper):
|
class TestSongProFileImport(SongImportTestHelper):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
@ -42,3 +44,8 @@ class TestSongProFileImport(SongImportTestHelper):
|
|||||||
"""
|
"""
|
||||||
self.file_import(TEST_PATH / 'amazing-grace.txt',
|
self.file_import(TEST_PATH / 'amazing-grace.txt',
|
||||||
self.load_external_result_data(TEST_PATH / 'Amazing Grace.json'))
|
self.load_external_result_data(TEST_PATH / 'Amazing Grace.json'))
|
||||||
|
|
||||||
|
test_file_import = TestSongProFileImport()
|
||||||
|
test_file_import.setUp()
|
||||||
|
test_file_import.test_song_import()
|
||||||
|
test_file_import.tearDown()
|
||||||
|
@ -33,6 +33,8 @@ from tests.utils.constants import RESOURCE_PATH
|
|||||||
TEST_PATH = RESOURCE_PATH / 'songs' / 'songshowplus'
|
TEST_PATH = RESOURCE_PATH / 'songs' / 'songshowplus'
|
||||||
|
|
||||||
|
|
||||||
|
def test_song_show_plus(mock_settings):
|
||||||
|
|
||||||
class TestSongShowPlusFileImport(SongImportTestHelper):
|
class TestSongShowPlusFileImport(SongImportTestHelper):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
@ -53,6 +55,11 @@ class TestSongShowPlusFileImport(SongImportTestHelper):
|
|||||||
self.file_import([TEST_PATH / 'cleanse-me.sbsong'],
|
self.file_import([TEST_PATH / 'cleanse-me.sbsong'],
|
||||||
self.load_external_result_data(TEST_PATH / 'cleanse-me.json'))
|
self.load_external_result_data(TEST_PATH / 'cleanse-me.json'))
|
||||||
|
|
||||||
|
test_file_import = TestSongShowPlusFileImport()
|
||||||
|
test_file_import.setUp()
|
||||||
|
test_file_import.test_song_import()
|
||||||
|
test_file_import.tearDown()
|
||||||
|
|
||||||
|
|
||||||
def test_create_importer(registry):
|
def test_create_importer(registry):
|
||||||
"""
|
"""
|
||||||
|
@ -30,6 +30,8 @@ from tests.utils.constants import RESOURCE_PATH
|
|||||||
TEST_PATH = RESOURCE_PATH / 'songs' / 'sundayplus'
|
TEST_PATH = RESOURCE_PATH / 'songs' / 'sundayplus'
|
||||||
|
|
||||||
|
|
||||||
|
def test_sunday_plus(mock_settings):
|
||||||
|
|
||||||
class TestSundayPlusFileImport(SongImportTestHelper):
|
class TestSundayPlusFileImport(SongImportTestHelper):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
@ -46,3 +48,8 @@ class TestSundayPlusFileImport(SongImportTestHelper):
|
|||||||
mocked_retrieve_windows_encoding.return_value = 'cp1252'
|
mocked_retrieve_windows_encoding.return_value = 'cp1252'
|
||||||
self.file_import([TEST_PATH / 'Amazing Grace.ptf'],
|
self.file_import([TEST_PATH / 'Amazing Grace.ptf'],
|
||||||
self.load_external_result_data(TEST_PATH / 'Amazing Grace.json'))
|
self.load_external_result_data(TEST_PATH / 'Amazing Grace.json'))
|
||||||
|
|
||||||
|
test_file_import = TestSundayPlusFileImport()
|
||||||
|
test_file_import.setUp()
|
||||||
|
test_file_import.test_song_import()
|
||||||
|
test_file_import.tearDown()
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
"""
|
"""
|
||||||
This module contains tests for the VideoPsalm song importer.
|
This module contains tests for the VideoPsalm song importer.
|
||||||
"""
|
"""
|
||||||
|
from openlp.core.common.registry import Registry
|
||||||
from tests.helpers.songfileimport import SongImportTestHelper
|
from tests.helpers.songfileimport import SongImportTestHelper
|
||||||
from tests.utils.constants import RESOURCE_PATH
|
from tests.utils.constants import RESOURCE_PATH
|
||||||
|
|
||||||
@ -29,6 +29,8 @@ from tests.utils.constants import RESOURCE_PATH
|
|||||||
TEST_PATH = RESOURCE_PATH / 'songs' / 'videopsalm'
|
TEST_PATH = RESOURCE_PATH / 'songs' / 'videopsalm'
|
||||||
|
|
||||||
|
|
||||||
|
def test_video_psalms(mock_settings):
|
||||||
|
|
||||||
class TestVideoPsalmFileImport(SongImportTestHelper):
|
class TestVideoPsalmFileImport(SongImportTestHelper):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
@ -41,9 +43,15 @@ class TestVideoPsalmFileImport(SongImportTestHelper):
|
|||||||
Test that loading an VideoPsalm file works correctly on various files
|
Test that loading an VideoPsalm file works correctly on various files
|
||||||
"""
|
"""
|
||||||
# Mock out the settings - always return False
|
# Mock out the settings - always return False
|
||||||
self.settings.value.side_effect = lambda value: True if value == 'songs/enable chords' else False
|
Registry().get('settings').value.side_effect = lambda value: True \
|
||||||
|
if value == 'songs/enable chords' else False
|
||||||
# Do the test import
|
# Do the test import
|
||||||
self.file_import(TEST_PATH / 'videopsalm-as-safe-a-stronghold.json',
|
self.file_import(TEST_PATH / 'videopsalm-as-safe-a-stronghold.json',
|
||||||
self.load_external_result_data(TEST_PATH / 'as-safe-a-stronghold.json'))
|
self.load_external_result_data(TEST_PATH / 'as-safe-a-stronghold.json'))
|
||||||
self.file_import(TEST_PATH / 'videopsalm-as-safe-a-stronghold2.json',
|
self.file_import(TEST_PATH / 'videopsalm-as-safe-a-stronghold2.json',
|
||||||
self.load_external_result_data(TEST_PATH / 'as-safe-a-stronghold2.json'))
|
self.load_external_result_data(TEST_PATH / 'as-safe-a-stronghold2.json'))
|
||||||
|
|
||||||
|
test_file_import = TestVideoPsalmFileImport()
|
||||||
|
test_file_import.setUp()
|
||||||
|
test_file_import.test_song_import()
|
||||||
|
test_file_import.tearDown()
|
||||||
|
@ -29,6 +29,8 @@ from tests.utils.constants import RESOURCE_PATH
|
|||||||
TEST_PATH = RESOURCE_PATH / 'songs' / 'worshipassistant'
|
TEST_PATH = RESOURCE_PATH / 'songs' / 'worshipassistant'
|
||||||
|
|
||||||
|
|
||||||
|
def test_chordpro(mock_settings):
|
||||||
|
|
||||||
class TestWorshipAssistantFileImport(SongImportTestHelper):
|
class TestWorshipAssistantFileImport(SongImportTestHelper):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
@ -45,3 +47,8 @@ class TestWorshipAssistantFileImport(SongImportTestHelper):
|
|||||||
self.load_external_result_data(TEST_PATH / 'would_you_be_free.json'))
|
self.load_external_result_data(TEST_PATH / 'would_you_be_free.json'))
|
||||||
self.file_import(TEST_PATH / 'would_you_be_free2.csv',
|
self.file_import(TEST_PATH / 'would_you_be_free2.csv',
|
||||||
self.load_external_result_data(TEST_PATH / 'would_you_be_free.json'))
|
self.load_external_result_data(TEST_PATH / 'would_you_be_free.json'))
|
||||||
|
|
||||||
|
test_file_import = TestWorshipAssistantFileImport()
|
||||||
|
test_file_import.setUp()
|
||||||
|
test_file_import.test_song_import()
|
||||||
|
test_file_import.tearDown()
|
||||||
|
@ -21,10 +21,8 @@
|
|||||||
"""
|
"""
|
||||||
This module contains tests for the ZionWorx song importer.
|
This module contains tests for the ZionWorx song importer.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
|
||||||
from unittest.mock import MagicMock, patch
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from openlp.core.common.registry import Registry
|
|
||||||
from openlp.plugins.songs.lib.importers.songimport import SongImport
|
from openlp.plugins.songs.lib.importers.songimport import SongImport
|
||||||
from openlp.plugins.songs.lib.importers.zionworx import ZionWorxImport
|
from openlp.plugins.songs.lib.importers.zionworx import ZionWorxImport
|
||||||
from tests.helpers.songfileimport import SongImportTestHelper
|
from tests.helpers.songfileimport import SongImportTestHelper
|
||||||
@ -34,17 +32,7 @@ from tests.utils.constants import RESOURCE_PATH
|
|||||||
TEST_PATH = RESOURCE_PATH / 'songs' / 'zionworx'
|
TEST_PATH = RESOURCE_PATH / 'songs' / 'zionworx'
|
||||||
|
|
||||||
|
|
||||||
class TestZionWorxImport(TestCase):
|
def test_create_importer(registry):
|
||||||
"""
|
|
||||||
Test the functions in the :mod:`zionworximport` module.
|
|
||||||
"""
|
|
||||||
def setUp(self):
|
|
||||||
"""
|
|
||||||
Create the registry
|
|
||||||
"""
|
|
||||||
Registry.create()
|
|
||||||
|
|
||||||
def test_create_importer(self):
|
|
||||||
"""
|
"""
|
||||||
Test creating an instance of the ZionWorx file importer
|
Test creating an instance of the ZionWorx file importer
|
||||||
"""
|
"""
|
||||||
@ -59,6 +47,8 @@ class TestZionWorxImport(TestCase):
|
|||||||
assert isinstance(importer, SongImport)
|
assert isinstance(importer, SongImport)
|
||||||
|
|
||||||
|
|
||||||
|
def test_zion_wrox(mock_settings):
|
||||||
|
|
||||||
class TestZionWorxFileImport(SongImportTestHelper):
|
class TestZionWorxFileImport(SongImportTestHelper):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
@ -71,3 +61,8 @@ class TestZionWorxFileImport(SongImportTestHelper):
|
|||||||
Test that loading an ZionWorx file works correctly on various files
|
Test that loading an ZionWorx file works correctly on various files
|
||||||
"""
|
"""
|
||||||
self.file_import(TEST_PATH / 'zionworx.csv', self.load_external_result_data(TEST_PATH / 'zionworx.json'))
|
self.file_import(TEST_PATH / 'zionworx.csv', self.load_external_result_data(TEST_PATH / 'zionworx.json'))
|
||||||
|
|
||||||
|
test_file_import = TestZionWorxFileImport()
|
||||||
|
test_file_import.setUp()
|
||||||
|
test_file_import.test_song_import()
|
||||||
|
test_file_import.tearDown()
|
||||||
|
@ -24,16 +24,12 @@ song files from third party applications.
|
|||||||
"""
|
"""
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
from unittest import TestCase
|
|
||||||
from unittest.mock import MagicMock, call, patch
|
from unittest.mock import MagicMock, call, patch
|
||||||
|
|
||||||
from openlp.core.common.registry import Registry
|
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class SongImportTestHelper(TestCase):
|
class SongImportTestHelper(object):
|
||||||
"""
|
"""
|
||||||
This class is designed to be a helper class to reduce repetition when testing the import of song files.
|
This class is designed to be a helper class to reduce repetition when testing the import of song files.
|
||||||
"""
|
"""
|
||||||
@ -47,9 +43,6 @@ class SongImportTestHelper(TestCase):
|
|||||||
"""
|
"""
|
||||||
Patch and set up the mocks required.
|
Patch and set up the mocks required.
|
||||||
"""
|
"""
|
||||||
Registry.create()
|
|
||||||
Registry().register('settings', MagicMock())
|
|
||||||
self.settings = Registry().get('settings')
|
|
||||||
self.add_copyright_patcher = patch('openlp.plugins.songs.lib.importers.%s.%s.add_copyright' %
|
self.add_copyright_patcher = patch('openlp.plugins.songs.lib.importers.%s.%s.add_copyright' %
|
||||||
(self.importer_module_name, self.importer_class_name))
|
(self.importer_module_name, self.importer_class_name))
|
||||||
self.add_verse_patcher = patch('openlp.plugins.songs.lib.importers.%s.%s.add_verse' %
|
self.add_verse_patcher = patch('openlp.plugins.songs.lib.importers.%s.%s.add_verse' %
|
||||||
|
Loading…
Reference in New Issue
Block a user