Add test for EasyWorship 6 importer.

This commit is contained in:
Gary Talent 2016-09-16 23:39:40 -05:00
parent b5f08bf54c
commit 5435dfc5cc
4 changed files with 9 additions and 3 deletions

View File

@ -342,8 +342,8 @@ class EasyWorshipSongImport(SongImport):
def import_sqlite_db(self):
# get database handles
songs_conn = sqlite3.connect(self.import_source + "/Songs.db")
words_conn = sqlite3.connect(self.import_source + "/SongWords.db")
songs_conn = sqlite3.connect(self.import_source + "/Databases/Data/Songs.db")
words_conn = sqlite3.connect(self.import_source + "/Databases/Data/SongWords.db")
if songs_conn is None or words_conn is None:
self.log_error(self.import_source, translate('SongsPlugin.EasyWorshipSongImport',
'This is not a valid Easy Worship 6 database.'))

View File

@ -406,6 +406,12 @@ class TestEasyWorshipSongImport(TestCase):
mocked_retrieve_windows_encoding.assert_any_call(encoding)
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.
"""
@ -433,7 +439,7 @@ class TestEasyWorshipSongImport(TestCase):
importer.topics = []
# WHEN: Importing each file
importer.import_source = os.path.join(TEST_PATH, 'Songs.DB')
importer.import_source = source_path
import_result = importer.do_import()
# THEN: do_import should return none, the song data should be as expected, and finish should have been