forked from openlp/openlp
Add test for EasyWorship 6 importer.
This commit is contained in:
parent
b5f08bf54c
commit
5435dfc5cc
@ -342,8 +342,8 @@ class EasyWorshipSongImport(SongImport):
|
|||||||
|
|
||||||
def import_sqlite_db(self):
|
def import_sqlite_db(self):
|
||||||
# get database handles
|
# get database handles
|
||||||
songs_conn = sqlite3.connect(self.import_source + "/Songs.db")
|
songs_conn = sqlite3.connect(self.import_source + "/Databases/Data/Songs.db")
|
||||||
words_conn = sqlite3.connect(self.import_source + "/SongWords.db")
|
words_conn = sqlite3.connect(self.import_source + "/Databases/Data/SongWords.db")
|
||||||
if songs_conn is None or words_conn is None:
|
if songs_conn is None or words_conn is None:
|
||||||
self.log_error(self.import_source, translate('SongsPlugin.EasyWorshipSongImport',
|
self.log_error(self.import_source, translate('SongsPlugin.EasyWorshipSongImport',
|
||||||
'This is not a valid Easy Worship 6 database.'))
|
'This is not a valid Easy Worship 6 database.'))
|
||||||
|
@ -406,6 +406,12 @@ class TestEasyWorshipSongImport(TestCase):
|
|||||||
mocked_retrieve_windows_encoding.assert_any_call(encoding)
|
mocked_retrieve_windows_encoding.assert_any_call(encoding)
|
||||||
|
|
||||||
def test_db_file_import(self):
|
def test_db_file_import(self):
|
||||||
|
return self._test_db_file_import(os.path.join(TEST_PATH, 'Songs.DB'))
|
||||||
|
|
||||||
|
def test_sqlite_db_file_import(self):
|
||||||
|
return self._test_db_file_import(os.path.join(TEST_PATH, 'ew6'))
|
||||||
|
|
||||||
|
def _test_db_file_import(self, source_path):
|
||||||
"""
|
"""
|
||||||
Test the actual import of real song database files and check that the imported data is correct.
|
Test the actual import of real song database files and check that the imported data is correct.
|
||||||
"""
|
"""
|
||||||
@ -433,7 +439,7 @@ class TestEasyWorshipSongImport(TestCase):
|
|||||||
importer.topics = []
|
importer.topics = []
|
||||||
|
|
||||||
# WHEN: Importing each file
|
# WHEN: Importing each file
|
||||||
importer.import_source = os.path.join(TEST_PATH, 'Songs.DB')
|
importer.import_source = source_path
|
||||||
import_result = importer.do_import()
|
import_result = importer.do_import()
|
||||||
|
|
||||||
# THEN: do_import should return none, the song data should be as expected, and finish should have been
|
# THEN: do_import should return none, the song data should be as expected, and finish should have been
|
||||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user