fix tests

This commit is contained in:
Tim Bentley 2016-07-23 06:24:28 +01:00
parent 6d9d2ef32e
commit 6ea956f432
2 changed files with 5 additions and 6 deletions

View File

@ -270,7 +270,6 @@ class OpenLyrics(object):
if song.songbook_entries:
songbooks = etree.SubElement(properties, 'songbooks')
for songbook_entry in song.songbook_entries:
# TODO IS THIS RIGHT AS IT FAILS WITH AN ERROR SHOULD IT BE AFTER THE IF TEST
element = self._add_text_to_element('songbook', songbooks, None, songbook_entry.songbook.name)
if songbook_entry.entry:
element.set('entry', songbook_entry.entry)
@ -459,7 +458,7 @@ class OpenLyrics(object):
self._add_tag_to_formatting(tag, tags_element)
# Replace end tags.
for tag in end_tags:
text = text.replace('{{/{tag}}}'.format(tag=tag), '</tag>')
text = text.replace('{/{tag}}}'.format(tag=tag), '</tag>')
# Replace \n with <br/>.
text = text.replace('\n', '<br/>')
element = etree.XML('<lines>{text}</lines>'.format(text=text))
@ -568,7 +567,7 @@ class OpenLyrics(object):
name = tag.get('name')
if name is None:
continue
start_tag = '{{/{name}}}'.format(name=name[:5])
start_tag = '{{{name}}}'.format(name=name[:5])
# Some tags have only start tag e.g. {br}
end_tag = '{{/{name}}}'.format(name=name[:5]) if hasattr(tag, 'close') else ''
openlp_tag = {

View File

@ -151,9 +151,9 @@ class TestOpenLyricsImport(TestCase, TestMixin):
ol._process_formatting_tags(song_xml, False)
# THEN: New tags should have been saved
# self.assertListEqual(json.loads(json.dumps(result_tags)),
# json.loads(str(Settings().value('formattingTags/html_tags'))),
# 'The formatting tags should contain both the old and the new')
self.assertListEqual(json.loads(json.dumps(result_tags)),
json.loads(str(Settings().value('formattingTags/html_tags'))),
'The formatting tags should contain both the old and the new')
def test_process_author(self):
"""