forked from openlp/openlp
Finished first test.
This commit is contained in:
parent
51ffb92d40
commit
e9e5976d22
@ -159,8 +159,8 @@ class OpsProImport(SongImport):
|
||||
# Remove comments
|
||||
verse_text = re.sub('\(.*?\)\r\n', '', verse_text, flags=re.IGNORECASE)
|
||||
self.add_verse(verse_text, verse_def)
|
||||
print(verse_def)
|
||||
print(verse_text)
|
||||
#print(verse_def)
|
||||
#print(verse_text)
|
||||
self.finish()
|
||||
|
||||
def extract_mdb_password(self):
|
||||
|
@ -23,6 +23,7 @@
|
||||
This module contains tests for the WorshipCenter Pro song importer.
|
||||
"""
|
||||
import os
|
||||
import json
|
||||
from unittest import TestCase, SkipTest
|
||||
|
||||
from tests.functional import patch, MagicMock
|
||||
@ -44,7 +45,6 @@ class TestRecord(object):
|
||||
self.Field = field
|
||||
self.Value = value
|
||||
|
||||
|
||||
class TestOpsProSongImport(TestCase):
|
||||
"""
|
||||
Test the functions in the :mod:`opsproimport` module.
|
||||
@ -74,7 +74,7 @@ class TestOpsProSongImport(TestCase):
|
||||
"""
|
||||
Test importing lyrics with a chorus in OPS Pro
|
||||
"""
|
||||
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
||||
# GIVEN: A mocked out SongImport class, a mocked out "manager" and a mocked song and lyrics entry
|
||||
mocked_manager = MagicMock()
|
||||
importer = OpsProImport(mocked_manager, filenames=[])
|
||||
song = MagicMock()
|
||||
@ -95,7 +95,13 @@ class TestOpsProSongImport(TestCase):
|
||||
# WHEN: An importer object is created
|
||||
importer.process_song(song, lyrics, [])
|
||||
|
||||
# THEN: The importer object should not be None
|
||||
print(importer.verses)
|
||||
print(importer.verse_order_list)
|
||||
self.assertIsNone(importer, 'Import should not be none')
|
||||
# THEN: The imported data should look like expected
|
||||
result_file = open(os.path.join(TEST_PATH, 'You are so faithful.json'), 'rb')
|
||||
result_data = json.loads(result_file.read().decode())
|
||||
self.assertListEqual(importer.verses, self._get_data(result_data, 'verses'))
|
||||
self.assertListEqual(importer.verse_order_list_generated, self._get_data(result_data, 'verse_order_list'))
|
||||
|
||||
def _get_data(self, data, key):
|
||||
if key in data:
|
||||
return data[key]
|
||||
return ''
|
||||
|
@ -23,11 +23,8 @@ This module contains tests for the VideoPsalm song importer.
|
||||
"""
|
||||
|
||||
import os
|
||||
from unittest import TestCase
|
||||
|
||||
from tests.helpers.songfileimport import SongImportTestHelper
|
||||
from openlp.core.common import Registry
|
||||
from tests.functional import patch, MagicMock
|
||||
|
||||
TEST_PATH = os.path.abspath(
|
||||
os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources', 'videopsalmsongs'))
|
||||
|
31
tests/resources/opsprosongs/You are so faithful.json
Normal file
31
tests/resources/opsprosongs/You are so faithful.json
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"title": "You are so faithful",
|
||||
"verse_order_list": ["v1", "c1", "v2", "c1", "v3", "c1", "v4"],
|
||||
"verses": [
|
||||
[
|
||||
"v1",
|
||||
"You are so faithful\r\nso faithful, so faithful.\r\nYou are so faithful\r\nso faithful, so faithful.",
|
||||
null
|
||||
],
|
||||
[
|
||||
"c1",
|
||||
"That's why I praise you\r\nin the morning\r\nThat's why I praise you\r\nin the noontime.\r\nThat's why I praise you\r\nin the evening\r\nThat's why I praise you\r\nall the time.",
|
||||
null
|
||||
],
|
||||
[
|
||||
"v2",
|
||||
"You are so loving\r\nso loving, so loving.\r\nYou are so loving\r\nso loving, so loving.",
|
||||
null
|
||||
],
|
||||
[
|
||||
"v3",
|
||||
"You are so caring\r\nso caring, so caring.\r\nYou are so caring\r\nso caring, so caring.",
|
||||
null
|
||||
],
|
||||
[
|
||||
"v4",
|
||||
"You are so mighty\r\nso mighty, so mighty.\r\nYou are so mighty\r\nso mighty, so mighty.",
|
||||
null
|
||||
]
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user