test theme, alttheme -> our theme

This commit is contained in:
Martin Thompson 2010-07-07 21:16:14 +01:00
parent 7297248d88
commit b3559a993d
2 changed files with 12 additions and 2 deletions

View File

@ -118,6 +118,8 @@ class OpenSongImport:
self.do_import_file(file)
if commit:
self.finish()
def do_import_file(self, file):
"""
Process the OpenSong file - pass in a file-like object, not a filename
@ -135,6 +137,13 @@ class OpenSongImport:
for (attr, fn) in decode.items():
if attr in fields:
fn(unicode(root.__getattr__(attr)))
res = []
if u'theme' in fields:
res.append(unicode(root.theme))
if u'alttheme' in fields:
res.append(unicode(root.alttheme))
self.song.theme=u', '.join(res)
# data storage while importing
verses = {}

View File

@ -30,7 +30,7 @@ def test():
manager = SongManager()
o = OpenSongImport(manager)
o.do_import(u'test.opensong', commit=False)
# o.finish()
o.finish()
o.song.print_song()
assert o.song.copyright == u'2010 Martin Thompson'
assert o.song.authors == [u'MartiÑ Thómpson']
@ -45,7 +45,8 @@ def test():
assert [u'V2', u'v2 Line 1\nV2 Line 2'] in o.song.verses
assert o.song.verse_order_list == [u'V1', u'C', u'V2', u'C2', u'V3', u'B1', u'V1']
assert o.song.ccli_number == u'Blah'
print u':%s:'%o.song.theme
assert o.song.theme == u'TestTheme, TestAltTheme'
o.do_import(u'test.opensong.zip', commit=False)
# o.finish()
o.song.print_song()