Move song test resources

lp:~phill-ridout/openlp/moar_test_cleanups (revision 2809)
https://ci.openlp.io/job/Branch-01-Pull/2390/                          [WAITING]
[RUNNING]
[SUCCESS]
https://ci.openlp.io/job/Branch-02a-Linux-Tests/2291/                  [WAITING]
[RUNNING]
[SUCCESS]
https://ci.openlp.io/job/Branch-02b-macOS-Tests/86/                    [WAITING]
[SUCCESS]
https://ci.openlp.io/job/Branch-03a-Build-Source/11/                   [WAITING]
[SUCCESS]
https://ci.openlp.io/job/Bra...

bzr-revno: 2803
This commit is contained in:
Phill 2017-12-24 09:57:44 +00:00 committed by Phill Ridout
commit 6e2bc427a7
112 changed files with 45 additions and 45 deletions

View File

@ -34,7 +34,7 @@ from openlp.core.common.registry import Registry
from openlp.core.common.path import Path from openlp.core.common.path import Path
from openlp.core.ui import ThemeManager from openlp.core.ui import ThemeManager
from tests.utils.constants import TEST_RESOURCES_PATH from tests.utils.constants import RESOURCE_PATH
class TestThemeManager(TestCase): class TestThemeManager(TestCase):
@ -60,7 +60,7 @@ class TestThemeManager(TestCase):
""" """
# GIVEN: A new ThemeManager instance. # GIVEN: A new ThemeManager instance.
theme_manager = ThemeManager() theme_manager = ThemeManager()
theme_manager.theme_path = Path(TEST_RESOURCES_PATH, 'themes') theme_manager.theme_path = RESOURCE_PATH / 'themes'
mocked_zipfile_init.return_value = None mocked_zipfile_init.return_value = None
# WHEN: The theme is exported # WHEN: The theme is exported
@ -68,7 +68,7 @@ class TestThemeManager(TestCase):
# THEN: The zipfile should be created at the given path # THEN: The zipfile should be created at the given path
mocked_zipfile_init.assert_called_with(os.path.join('some', 'path', 'Default.otz'), 'w') mocked_zipfile_init.assert_called_with(os.path.join('some', 'path', 'Default.otz'), 'w')
mocked_zipfile_write.assert_called_with(os.path.join(TEST_RESOURCES_PATH, 'themes', 'Default', 'Default.xml'), mocked_zipfile_write.assert_called_with(str(RESOURCE_PATH / 'themes' / 'Default' / 'Default.xml'),
os.path.join('Default', 'Default.xml')) os.path.join('Default', 'Default.xml'))
def test_initial_theme_manager(self): def test_initial_theme_manager(self):
@ -100,8 +100,8 @@ class TestThemeManager(TestCase):
mocked_theme.extract_formatted_xml.return_value = 'fake_theme_xml'.encode() mocked_theme.extract_formatted_xml.return_value = 'fake_theme_xml'.encode()
# WHEN: Calling _write_theme with path to the same image, but the path written slightly different # WHEN: Calling _write_theme with path to the same image, but the path written slightly different
file_name1 = Path(TEST_RESOURCES_PATH, 'church.jpg') file_path_1 = RESOURCE_PATH / 'church.jpg'
theme_manager._write_theme(mocked_theme, file_name1, file_name1) theme_manager._write_theme(mocked_theme, file_path_1, file_path_1)
# THEN: The mocked_copyfile should not have been called # THEN: The mocked_copyfile should not have been called
assert mocked_copyfile.called is False, 'copyfile should not be called' assert mocked_copyfile.called is False, 'copyfile should not be called'
@ -123,9 +123,9 @@ class TestThemeManager(TestCase):
mocked_theme.filename = "filename" mocked_theme.filename = "filename"
# WHEN: Calling _write_theme with path to different images # WHEN: Calling _write_theme with path to different images
file_name1 = Path(TEST_RESOURCES_PATH, 'church.jpg') file_path_1 = RESOURCE_PATH / 'church.jpg'
file_name2 = Path(TEST_RESOURCES_PATH, 'church2.jpg') file_path_2 = RESOURCE_PATH / 'church2.jpg'
theme_manager._write_theme(mocked_theme, file_name1, file_name2) theme_manager._write_theme(mocked_theme, file_path_1, file_path_2)
# THEN: The mocked_copyfile should not have been called # THEN: The mocked_copyfile should not have been called
assert mocked_copyfile.called is True, 'copyfile should be called' assert mocked_copyfile.called is True, 'copyfile should be called'
@ -200,10 +200,10 @@ class TestThemeManager(TestCase):
theme_manager.generate_and_save_image = MagicMock() theme_manager.generate_and_save_image = MagicMock()
theme_manager.theme_path = None theme_manager.theme_path = None
folder_path = Path(mkdtemp()) folder_path = Path(mkdtemp())
theme_file = Path(TEST_RESOURCES_PATH, 'themes', 'Moss_on_tree.otz') theme_file_path = RESOURCE_PATH / 'themes' / 'Moss_on_tree.otz'
# WHEN: We try to unzip it # WHEN: We try to unzip it
theme_manager.unzip_theme(theme_file, folder_path) theme_manager.unzip_theme(theme_file_path, folder_path)
# THEN: Files should be unpacked # THEN: Files should be unpacked
assert (folder_path / 'Moss on tree' / 'Moss on tree.xml').exists() is True assert (folder_path / 'Moss on tree' / 'Moss on tree.xml').exists() is True

View File

@ -32,7 +32,7 @@ from openlp.core.common.path import Path
from openlp.plugins.presentations.lib.impresscontroller import ImpressController, ImpressDocument, TextType from openlp.plugins.presentations.lib.impresscontroller import ImpressController, ImpressDocument, TextType
from openlp.plugins.presentations.presentationplugin import __default_settings__ from openlp.plugins.presentations.presentationplugin import __default_settings__
from tests.utils.constants import TEST_RESOURCES_PATH from tests.utils.constants import RESOURCE_PATH
from tests.helpers.testmixin import TestMixin from tests.helpers.testmixin import TestMixin
@ -134,7 +134,7 @@ class TestImpressDocument(TestCase):
mocked_plugin = MagicMock() mocked_plugin = MagicMock()
mocked_plugin.settings_section = 'presentations' mocked_plugin.settings_section = 'presentations'
Settings().extend_default_settings(__default_settings__) Settings().extend_default_settings(__default_settings__)
self.file_name = Path(TEST_RESOURCES_PATH, 'presentations', 'test.pptx') self.file_name = RESOURCE_PATH / 'presentations' / 'test.pptx'
self.ppc = ImpressController(mocked_plugin) self.ppc = ImpressController(mocked_plugin)
self.doc = ImpressDocument(self.ppc, self.file_name) self.doc = ImpressDocument(self.ppc, self.file_name)

View File

@ -35,7 +35,7 @@ from openlp.core.common.settings import Settings
from openlp.core.common.path import Path from openlp.core.common.path import Path
from openlp.core.display.screens import ScreenList from openlp.core.display.screens import ScreenList
from tests.utils.constants import TEST_RESOURCES_PATH from tests.utils.constants import RESOURCE_PATH
from tests.helpers.testmixin import TestMixin from tests.helpers.testmixin import TestMixin
__default_settings__ = { __default_settings__ = {
@ -99,7 +99,7 @@ class TestPdfController(TestCase, TestMixin):
Test loading of a Pdf using the PdfController Test loading of a Pdf using the PdfController
""" """
# GIVEN: A Pdf-file # GIVEN: A Pdf-file
test_file = Path(TEST_RESOURCES_PATH, 'presentations', 'pdf_test1.pdf') test_file_path = RESOURCE_PATH / 'presentations' / 'pdf_test1.pdf'
# WHEN: The Pdf is loaded # WHEN: The Pdf is loaded
controller = PdfController(plugin=self.mock_plugin) controller = PdfController(plugin=self.mock_plugin)
@ -107,7 +107,7 @@ class TestPdfController(TestCase, TestMixin):
raise SkipTest('Could not detect mudraw or ghostscript, so skipping PDF test') raise SkipTest('Could not detect mudraw or ghostscript, so skipping PDF test')
controller.temp_folder = self.temp_folder_path controller.temp_folder = self.temp_folder_path
controller.thumbnail_folder = self.thumbnail_folder_path controller.thumbnail_folder = self.thumbnail_folder_path
document = PdfDocument(controller, test_file) document = PdfDocument(controller, test_file_path)
loaded = document.load_presentation() loaded = document.load_presentation()
# THEN: The load should succeed and we should be able to get a pagecount # THEN: The load should succeed and we should be able to get a pagecount
@ -119,7 +119,7 @@ class TestPdfController(TestCase, TestMixin):
Test loading of a Pdf and check size of generate pictures Test loading of a Pdf and check size of generate pictures
""" """
# GIVEN: A Pdf-file # GIVEN: A Pdf-file
test_file = Path(TEST_RESOURCES_PATH, 'presentations', 'pdf_test1.pdf') test_file_path = RESOURCE_PATH / 'presentations' / 'pdf_test1.pdf'
# WHEN: The Pdf is loaded # WHEN: The Pdf is loaded
controller = PdfController(plugin=self.mock_plugin) controller = PdfController(plugin=self.mock_plugin)
@ -127,7 +127,7 @@ class TestPdfController(TestCase, TestMixin):
raise SkipTest('Could not detect mudraw or ghostscript, so skipping PDF test') raise SkipTest('Could not detect mudraw or ghostscript, so skipping PDF test')
controller.temp_folder = self.temp_folder_path controller.temp_folder = self.temp_folder_path
controller.thumbnail_folder = self.thumbnail_folder_path controller.thumbnail_folder = self.thumbnail_folder_path
document = PdfDocument(controller, test_file) document = PdfDocument(controller, test_file_path)
loaded = document.load_presentation() loaded = document.load_presentation()
# THEN: The load should succeed and pictures should be created and have been scales to fit the screen # THEN: The load should succeed and pictures should be created and have been scales to fit the screen

View File

@ -32,7 +32,7 @@ from openlp.core.common import is_win
from openlp.core.common.path import Path from openlp.core.common.path import Path
from tests.helpers.testmixin import TestMixin from tests.helpers.testmixin import TestMixin
from tests.utils.constants import TEST_RESOURCES_PATH from tests.utils.constants import RESOURCE_PATH
class TestPptviewController(TestCase, TestMixin): class TestPptviewController(TestCase, TestMixin):
@ -172,7 +172,7 @@ class TestPptviewDocument(TestCase):
""" """
# GIVEN: mocked PresentationController.save_titles_and_notes and a pptx file # GIVEN: mocked PresentationController.save_titles_and_notes and a pptx file
doc = PptviewDocument(self.mock_controller, self.mock_presentation) doc = PptviewDocument(self.mock_controller, self.mock_presentation)
doc.file_path = Path(TEST_RESOURCES_PATH, 'presentations', 'test.pptx') doc.file_path = RESOURCE_PATH / 'presentations' / 'test.pptx'
doc.save_titles_and_notes = MagicMock() doc.save_titles_and_notes = MagicMock()
# WHEN reading the titles and notes # WHEN reading the titles and notes
@ -216,7 +216,7 @@ class TestPptviewDocument(TestCase):
mocked_is_zf.return_value = False mocked_is_zf.return_value = False
mocked_open.filesize = 10 mocked_open.filesize = 10
doc = PptviewDocument(self.mock_controller, self.mock_presentation) doc = PptviewDocument(self.mock_controller, self.mock_presentation)
doc.file_path = Path(TEST_RESOURCES_PATH, 'presentations', 'test.ppt') doc.file_path = RESOURCE_PATH / 'presentations' / 'test.ppt'
doc.save_titles_and_notes = MagicMock() doc.save_titles_and_notes = MagicMock()
# WHEN: reading the titles and notes # WHEN: reading the titles and notes

View File

@ -27,7 +27,7 @@ from unittest.mock import patch, MagicMock
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
TEST_PATH = RESOURCE_PATH / 'chordprosongs' TEST_PATH = RESOURCE_PATH / 'songs' / 'chordpro'
class TestChordProFileImport(SongImportTestHelper): class TestChordProFileImport(SongImportTestHelper):

View File

@ -24,7 +24,7 @@ This module contains tests for the EasySlides song importer.
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
TEST_PATH = RESOURCE_PATH / 'easyslidessongs' TEST_PATH = RESOURCE_PATH / 'songs' / 'easyslides'
class TestEasySlidesFileImport(SongImportTestHelper): class TestEasySlidesFileImport(SongImportTestHelper):

View File

@ -31,7 +31,7 @@ from openlp.plugins.songs.lib.importers.easyworship import EasyWorshipSongImport
from tests.utils.constants import RESOURCE_PATH from tests.utils.constants import RESOURCE_PATH
TEST_PATH = RESOURCE_PATH / 'easyworshipsongs' TEST_PATH = RESOURCE_PATH / 'songs' / 'easyworship'
SONG_TEST_DATA = [ SONG_TEST_DATA = [
{'title': 'Amazing Grace', {'title': 'Amazing Grace',
'authors': ['John Newton'], 'authors': ['John Newton'],

View File

@ -24,7 +24,7 @@ This module contains tests for the LyriX song importer.
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
TEST_PATH = RESOURCE_PATH / 'lyrixsongs' TEST_PATH = RESOURCE_PATH / 'songs' / 'lyrix'
class TestLyrixFileImport(SongImportTestHelper): class TestLyrixFileImport(SongImportTestHelper):

View File

@ -37,7 +37,7 @@ from openlp.plugins.songs.lib.openlyricsxml import OpenLyrics
from tests.helpers.testmixin import TestMixin from tests.helpers.testmixin import TestMixin
from tests.utils.constants import RESOURCE_PATH from tests.utils.constants import RESOURCE_PATH
TEST_PATH = RESOURCE_PATH / 'openlyricssongs' TEST_PATH = RESOURCE_PATH / 'songs' / 'openlyrics'
SONG_TEST_DATA = { SONG_TEST_DATA = {
'What a friend we have in Jesus.xml': { 'What a friend we have in Jesus.xml': {
'title': 'What A Friend We Have In Jesus', 'title': 'What A Friend We Have In Jesus',

View File

@ -31,7 +31,7 @@ from openlp.plugins.songs.lib.importers.opensong import OpenSongImport
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
TEST_PATH = RESOURCE_PATH / 'opensongsongs' TEST_PATH = RESOURCE_PATH / 'songs' / 'opensong'
class TestOpenSongFileImport(SongImportTestHelper): class TestOpenSongFileImport(SongImportTestHelper):

View File

@ -35,7 +35,7 @@ except ImportError:
from tests.utils import load_external_result_data from tests.utils import load_external_result_data
from tests.utils.constants import RESOURCE_PATH from tests.utils.constants import RESOURCE_PATH
TEST_PATH = RESOURCE_PATH / 'opsprosongs' TEST_PATH = RESOURCE_PATH / 'songs' / 'opspro'
def _get_item(data, key): def _get_item(data, key):

View File

@ -26,7 +26,7 @@ ProPresenter song files into the current installation database.
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
TEST_PATH = RESOURCE_PATH / 'powerpraisesongs' TEST_PATH = RESOURCE_PATH / 'songs' / 'powerpraise'
class TestPowerPraiseFileImport(SongImportTestHelper): class TestPowerPraiseFileImport(SongImportTestHelper):

View File

@ -25,7 +25,7 @@ This module contains tests for the PresentationManager song importer.
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
TEST_PATH = RESOURCE_PATH / 'presentationmanagersongs' TEST_PATH = RESOURCE_PATH / 'songs' / 'presentationmanager'
class TestPresentationManagerFileImport(SongImportTestHelper): class TestPresentationManagerFileImport(SongImportTestHelper):

View File

@ -26,7 +26,7 @@ ProPresenter song files into the current installation database.
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
TEST_PATH = RESOURCE_PATH / 'propresentersongs' TEST_PATH = RESOURCE_PATH / 'songs' / 'propresenter'
class TestProPresenterFileImport(SongImportTestHelper): class TestProPresenterFileImport(SongImportTestHelper):

View File

@ -31,7 +31,7 @@ from openlp.plugins.songs.lib.importers.songbeamer import SongBeamerImport, Song
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
TEST_PATH = RESOURCE_PATH / 'songbeamersongs' TEST_PATH = RESOURCE_PATH / 'songs' / 'songbeamer'
class TestSongBeamerFileImport(SongImportTestHelper): class TestSongBeamerFileImport(SongImportTestHelper):

View File

@ -26,7 +26,7 @@ SongPro song files into the current installation database.
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
TEST_PATH = RESOURCE_PATH / 'songprosongs' TEST_PATH = RESOURCE_PATH / 'songs' / 'songpro'
class TestSongProFileImport(SongImportTestHelper): class TestSongProFileImport(SongImportTestHelper):

View File

@ -38,7 +38,7 @@ from tests.helpers.songfileimport import SongImportTestHelper
from tests.helpers.testmixin import TestMixin from tests.helpers.testmixin import TestMixin
from tests.utils.constants import RESOURCE_PATH from tests.utils.constants import RESOURCE_PATH
TEST_PATH = RESOURCE_PATH / 'songselect' TEST_PATH = RESOURCE_PATH / 'songs' / 'songselect'
class TestSongSelectImport(TestCase, TestMixin): class TestSongSelectImport(TestCase, TestMixin):

View File

@ -31,7 +31,7 @@ from openlp.plugins.songs.lib.importers.songshowplus import SongShowPlusImport
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
TEST_PATH = RESOURCE_PATH / 'songshowplussongs' TEST_PATH = RESOURCE_PATH / 'songs' / 'songshowplus'
class TestSongShowPlusFileImport(SongImportTestHelper): class TestSongShowPlusFileImport(SongImportTestHelper):

View File

@ -26,7 +26,7 @@ from unittest.mock import patch
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
TEST_PATH = RESOURCE_PATH / 'sundayplussongs' TEST_PATH = RESOURCE_PATH / 'songs' / 'sundayplus'
class TestSundayPlusFileImport(SongImportTestHelper): class TestSundayPlusFileImport(SongImportTestHelper):

View File

@ -26,7 +26,7 @@ from unittest.mock import patch, MagicMock
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
TEST_PATH = RESOURCE_PATH / 'videopsalmsongs' TEST_PATH = RESOURCE_PATH / 'songs' / 'videopsalm'
class TestVideoPsalmFileImport(SongImportTestHelper): class TestVideoPsalmFileImport(SongImportTestHelper):

View File

@ -25,7 +25,7 @@ This module contains tests for the Words of Worship song importer.
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
TEST_PATH = RESOURCE_PATH / 'wordsofworshipsongs' TEST_PATH = RESOURCE_PATH / 'songs' / 'wordsofworship'
class TestWordsOfWorshipFileImport(SongImportTestHelper): class TestWordsOfWorshipFileImport(SongImportTestHelper):

View File

@ -26,7 +26,7 @@ WorshipAssistant song files into the current installation database.
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
TEST_PATH = RESOURCE_PATH / 'worshipassistantsongs' TEST_PATH = RESOURCE_PATH / 'songs' / 'worshipassistant'
class TestWorshipAssistantFileImport(SongImportTestHelper): class TestWorshipAssistantFileImport(SongImportTestHelper):

View File

@ -32,7 +32,7 @@ from openlp.plugins.songs.lib.importers.zionworx import ZionWorxImport
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
TEST_PATH = RESOURCE_PATH / 'zionworxsongs' TEST_PATH = RESOURCE_PATH / 'songs' / 'zionworx'
class TestZionWorxImport(TestCase): class TestZionWorxImport(TestCase):

View File

@ -25,8 +25,8 @@ Functional tests to test the AppLocation class and related methods.
from unittest import TestCase from unittest import TestCase
from openlp.core.common import is_not_image_file from openlp.core.common import is_not_image_file
from openlp.core.common.path import Path
from tests.utils.constants import TEST_RESOURCES_PATH from tests.utils.constants import RESOURCE_PATH
from tests.helpers.testmixin import TestMixin from tests.helpers.testmixin import TestMixin
@ -59,10 +59,10 @@ class TestUtils(TestCase, TestMixin):
Test the method handles an image file Test the method handles an image file
""" """
# Given and empty string # Given and empty string
file_name = Path(TEST_RESOURCES_PATH, 'church.jpg') file_path = RESOURCE_PATH / 'church.jpg'
# WHEN testing for it # WHEN testing for it
result = is_not_image_file(file_name) result = is_not_image_file(file_path)
# THEN the result is false # THEN the result is false
assert result is False, 'The file is present so the test should return False' assert result is False, 'The file is present so the test should return False'
@ -72,10 +72,10 @@ class TestUtils(TestCase, TestMixin):
Test the method handles a non image file Test the method handles a non image file
""" """
# Given and empty string # Given and empty string
file_name = Path(TEST_RESOURCES_PATH, 'serviceitem_custom_1.osj') file_path = RESOURCE_PATH / 'serviceitem_custom_1.osj'
# WHEN testing for it # WHEN testing for it
result = is_not_image_file(file_name) result = is_not_image_file(file_path)
# THEN the result is false # THEN the result is false
assert result is True, 'The file is not an image file so the test should return True' assert result is True, 'The file is not an image file so the test should return True'

Some files were not shown because too many files have changed in this diff Show More