diff --git a/tests/functional/openlp_plugins/songs/test_worshipassistantimport.py b/tests/functional/openlp_plugins/songs/test_worshipassistantimport.py new file mode 100644 index 000000000..9d968beaa --- /dev/null +++ b/tests/functional/openlp_plugins/songs/test_worshipassistantimport.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2013 Raoul Snyman # +# Portions copyright (c) 2008-2013 Tim Bentley, Gerald Britton, Jonathan # +# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, # +# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. # +# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # +# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # +# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # +# Frode Woldsund, Martin Zibricky, Patrick Zimmermann # +# --------------------------------------------------------------------------- # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; version 2 of the License. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with this program; if not, write to the Free Software Foundation, Inc., 59 # +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # +############################################################################### +""" +The :mod:`worshipassistantimport` module provides the functionality for importing +WorshipAssistant song files into the current installation database. +""" + +import os + +from tests.helpers.songfileimport import SongImportTestHelper + +TEST_PATH = os.path.abspath( + os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources', 'worshipassistantsongs')) + + +class TestWorshipAssistantFileImport(SongImportTestHelper): + + def __init__(self, *args, **kwargs): + self.importer_class_name = 'WorshipAssistantImport' + self.importer_module_name = 'worshipassistantimport' + super(TestWorshipAssistantFileImport, self).__init__(*args, **kwargs) + + def test_song_import(self): + """ + Test that loading an Worship Assistant file works correctly + """ + self.file_import(os.path.join(TEST_PATH, 'du_herr.csv'), + self.load_external_result_data(os.path.join(TEST_PATH, 'du_herr.json'))) diff --git a/tests/resources/worshipassistantsongs/du_herr.csv b/tests/resources/worshipassistantsongs/du_herr.csv new file mode 100644 index 000000000..72c5b4735 --- /dev/null +++ b/tests/resources/worshipassistantsongs/du_herr.csv @@ -0,0 +1,30 @@ +"SongID","SongNr","Title","Author","Copyright","FirstLine","PriKey","AltKey","Tempo","Focus","Theme","Scripture","Active","Songbook","TimeSig","Introduced","LastUsed","TimesUsed","CCLINr","User1","User2","User3","User4","User5","Roadmap","Overmap","FileLink1","FileLink2","Updated","Lyrics","Info","Lyrics2","Background" +"4ee399dc-edda-4aa9-891e-a859ca093c78","NULL","Du, Herr, verläßt mich nicht","Carl Brockhaus / Johann Georg Bäßler 1806","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","1","1","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","NULL","2014-06-25 12:15:28.317","","NULL","[1] +Du, Herr, verläßt mich nicht. +Auf Dich mein Herz allein vertraut, +Mein Auge glaubend auf Dich schaut. +Du bist mein Heil, mein Licht, +Mein Fels, mein sichrer Hort. +Bin ich versucht, gibt's Not und Leid, +Du bleibst mein Trost, mein Arm im Streit, +Mein Licht am dunklen Ort. + +[2] +Ich weiß, daß Du mich liebst. +Bist mir in jeder Lage nah', +Wohin ich gehe – Du bist da, +Ja, Du mir alles gibst. +Ich überlaß mich Dir; +Denn Du, Herr, kennst mich ganz und gar +Und führst mich sicher, wunderbar, +Und bist selbst alles mir. + +[3] +In dieser Wüste hier +Find't nirgend meine Seele Ruh', +Denn meine Ruh' bist, Jesu, Du. +Wohl mir, ich geh' zu Dir! +Bald werd' ich bei Dir sein, +Bald mit den Deinen ewiglich +Anbeten, loben, preisen Dich, +Mich Deiner stets erfreun.","NULL" diff --git a/tests/resources/worshipassistantsongs/du_herr.json b/tests/resources/worshipassistantsongs/du_herr.json new file mode 100644 index 000000000..56f3a7f0c --- /dev/null +++ b/tests/resources/worshipassistantsongs/du_herr.json @@ -0,0 +1,21 @@ +{ + "authors": [ + "Carl Brockhaus / Johann Georg Bäßler 1806" + ], + "title": "Du, Herr, verläßt mich nicht", + "verse_order_list": [], + "verses": [ + [ + "Du, Herr, verläßt mich nicht.\nAuf Dich mein Herz allein vertraut,\nMein Auge glaubend auf Dich schaut.\nDu bist mein Heil, mein Licht,\nMein Fels, mein sichrer Hort.\nBin ich versucht, gibt's Not und Leid,\nDu bleibst mein Trost, mein Arm im Streit,\nMein Licht am dunklen Ort.\n", + "v1" + ], + [ + "Ich weiß, daß Du mich liebst.\nBist mir in jeder Lage nah',\nWohin ich gehe – Du bist da,\nJa, Du mir alles gibst.\nIch überlaß mich Dir;\nDenn Du, Herr, kennst mich ganz und gar\nUnd führst mich sicher, wunderbar,\nUnd bist selbst alles mir.\n", + "v2" + ], + [ + "In dieser Wüste hier\nFind't nirgend meine Seele Ruh',\nDenn meine Ruh' bist, Jesu, Du.\nWohl mir, ich geh' zu Dir!\nBald werd' ich bei Dir sein,\nBald mit den Deinen ewiglich\nAnbeten, loben, preisen Dich,\nMich Deiner stets erfreun.\n", + "v3" + ] + ] +} \ No newline at end of file