1
0
mirror of https://gitlab.com/openlp/openlp.git synced 2024-10-02 12:57:39 +00:00

test_opensong passes again

This commit is contained in:
Martin Thompson 2010-09-06 20:56:20 +01:00
parent 53dc52c7c8
commit db118196a5
3 changed files with 11 additions and 9 deletions

View File

@ -151,7 +151,7 @@ class OpenSongImport(SongImport):
self.do_import_file(file)
if self.commit:
self.finish()
if not self.commit:
if self.commit:
self.finish()
@ -296,5 +296,6 @@ class OpenSongImport(SongImport):
self.topics = topics
self.verse_order_list = verse_order_list
self.verses = verselist
xxx sort out where to call setdefaults
xxx need to make calls to insert to database here
# xxx sort out where to call setdefaults
# xxx need to make calls to insert to database here

View File

@ -52,16 +52,16 @@ class SongImport(QtCore.QObject):
"""
self.manager = manager
self.stop_import_flag = False
self.set_defaults()
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'songs_stop_import'), self.stop_import)
self.setDefaults()
self.set_defaults()
def setDefaults(self):
def set_defaults(self):
"""
Create defaults for properties - call this before each song
if importing many songs at once to ensure a clean beginning
"""
self.authors = []
self.title = u''
self.song_number = u''
self.alternate_title = u''
@ -251,6 +251,7 @@ class SongImport(QtCore.QObject):
"""
Write the song and its fields to disk
"""
log.info(u'commiting song %s to database', self.title)
song = Song()
song.title = self.title
song.search_title = self.remove_punctuation(self.title) \

View File

@ -69,9 +69,9 @@ def test():
assert o.topics == [u'TestTheme', u'TestAltTheme']
o.filenames = [u'test.opensong.zip']
o.set_defaults()
o.do_import()
o.print_song()
o.finish()
assert o.copyright == u'2010 Martin Thompson'
assert o.authors == [u'MartiÑ Thómpson']
assert o.title == u'Martins Test'
@ -87,8 +87,8 @@ def test():
assert o.verse_order_list == [u'V1', u'C1', u'V2', u'C2', u'V3', u'B1', u'V1']
o.filenames = [u'test2.opensong']
o.set_defaults()
o.do_import()
# o.finish()
o.print_song()
assert o.copyright == u'2010 Martin Thompson'
assert o.authors == [u'Martin Thompson']
@ -106,8 +106,8 @@ def test():
assert o.verse_order_list == [u'V1', u'V2', u'B1', u'C1', u'C2']
o.filenames = [u'test3.opensong']
o.set_defaults()
o.do_import()
# o.finish()
o.print_song()
assert o.copyright == u'2010'
assert o.authors == [u'Martin Thompson']