forked from openlp/openlp
test_opensong passes again
This commit is contained in:
parent
53dc52c7c8
commit
db118196a5
@ -151,7 +151,7 @@ class OpenSongImport(SongImport):
|
|||||||
self.do_import_file(file)
|
self.do_import_file(file)
|
||||||
if self.commit:
|
if self.commit:
|
||||||
self.finish()
|
self.finish()
|
||||||
if not self.commit:
|
if self.commit:
|
||||||
self.finish()
|
self.finish()
|
||||||
|
|
||||||
|
|
||||||
@ -296,5 +296,6 @@ class OpenSongImport(SongImport):
|
|||||||
self.topics = topics
|
self.topics = topics
|
||||||
self.verse_order_list = verse_order_list
|
self.verse_order_list = verse_order_list
|
||||||
self.verses = verselist
|
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
|
||||||
|
@ -52,16 +52,16 @@ class SongImport(QtCore.QObject):
|
|||||||
"""
|
"""
|
||||||
self.manager = manager
|
self.manager = manager
|
||||||
self.stop_import_flag = False
|
self.stop_import_flag = False
|
||||||
self.set_defaults()
|
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'songs_stop_import'), self.stop_import)
|
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
|
Create defaults for properties - call this before each song
|
||||||
if importing many songs at once to ensure a clean beginning
|
if importing many songs at once to ensure a clean beginning
|
||||||
"""
|
"""
|
||||||
|
self.authors = []
|
||||||
self.title = u''
|
self.title = u''
|
||||||
self.song_number = u''
|
self.song_number = u''
|
||||||
self.alternate_title = u''
|
self.alternate_title = u''
|
||||||
@ -251,6 +251,7 @@ class SongImport(QtCore.QObject):
|
|||||||
"""
|
"""
|
||||||
Write the song and its fields to disk
|
Write the song and its fields to disk
|
||||||
"""
|
"""
|
||||||
|
log.info(u'commiting song %s to database', self.title)
|
||||||
song = Song()
|
song = Song()
|
||||||
song.title = self.title
|
song.title = self.title
|
||||||
song.search_title = self.remove_punctuation(self.title) \
|
song.search_title = self.remove_punctuation(self.title) \
|
||||||
|
@ -69,9 +69,9 @@ def test():
|
|||||||
assert o.topics == [u'TestTheme', u'TestAltTheme']
|
assert o.topics == [u'TestTheme', u'TestAltTheme']
|
||||||
|
|
||||||
o.filenames = [u'test.opensong.zip']
|
o.filenames = [u'test.opensong.zip']
|
||||||
|
o.set_defaults()
|
||||||
o.do_import()
|
o.do_import()
|
||||||
o.print_song()
|
o.print_song()
|
||||||
o.finish()
|
|
||||||
assert o.copyright == u'2010 Martin Thompson'
|
assert o.copyright == u'2010 Martin Thompson'
|
||||||
assert o.authors == [u'MartiÑ Thómpson']
|
assert o.authors == [u'MartiÑ Thómpson']
|
||||||
assert o.title == u'Martins Test'
|
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']
|
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.filenames = [u'test2.opensong']
|
||||||
|
o.set_defaults()
|
||||||
o.do_import()
|
o.do_import()
|
||||||
# o.finish()
|
|
||||||
o.print_song()
|
o.print_song()
|
||||||
assert o.copyright == u'2010 Martin Thompson'
|
assert o.copyright == u'2010 Martin Thompson'
|
||||||
assert o.authors == [u'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']
|
assert o.verse_order_list == [u'V1', u'V2', u'B1', u'C1', u'C2']
|
||||||
|
|
||||||
o.filenames = [u'test3.opensong']
|
o.filenames = [u'test3.opensong']
|
||||||
|
o.set_defaults()
|
||||||
o.do_import()
|
o.do_import()
|
||||||
# o.finish()
|
|
||||||
o.print_song()
|
o.print_song()
|
||||||
assert o.copyright == u'2010'
|
assert o.copyright == u'2010'
|
||||||
assert o.authors == [u'Martin Thompson']
|
assert o.authors == [u'Martin Thompson']
|
||||||
|
Loading…
Reference in New Issue
Block a user