forked from openlp/openlp
Fixes
This commit is contained in:
parent
aaacbeac69
commit
ee7a8b9804
@ -196,7 +196,7 @@ class SongSelectImport(object):
|
|||||||
db_song.lyrics = song_xml.extract_xml()
|
db_song.lyrics = song_xml.extract_xml()
|
||||||
clean_song(self.db_manager, db_song)
|
clean_song(self.db_manager, db_song)
|
||||||
self.db_manager.save_object(db_song)
|
self.db_manager.save_object(db_song)
|
||||||
db_song.authors = []
|
db_song.authors_songs = []
|
||||||
for author_name in song['authors']:
|
for author_name in song['authors']:
|
||||||
author = self.db_manager.get_object_filtered(Author, Author.display_name == author_name)
|
author = self.db_manager.get_object_filtered(Author, Author.display_name == author_name)
|
||||||
if not author:
|
if not author:
|
||||||
|
@ -344,7 +344,7 @@ class TestSongSelect(TestCase):
|
|||||||
mocked_db_manager.get_object_filtered.assert_called_with(MockedAuthor, False)
|
mocked_db_manager.get_object_filtered.assert_called_with(MockedAuthor, False)
|
||||||
MockedAuthor.populate.assert_called_with(first_name='Public', last_name='Domain',
|
MockedAuthor.populate.assert_called_with(first_name='Public', last_name='Domain',
|
||||||
display_name='Public Domain')
|
display_name='Public Domain')
|
||||||
self.assertEqual(1, len(result.authors), 'There should only be one author')
|
self.assertEqual(1, len(result.authors_songs), 'There should only be one author')
|
||||||
|
|
||||||
def save_song_existing_author_test(self):
|
def save_song_existing_author_test(self):
|
||||||
"""
|
"""
|
||||||
@ -379,4 +379,4 @@ class TestSongSelect(TestCase):
|
|||||||
'The save_object() method should have been called twice')
|
'The save_object() method should have been called twice')
|
||||||
mocked_db_manager.get_object_filtered.assert_called_with(MockedAuthor, False)
|
mocked_db_manager.get_object_filtered.assert_called_with(MockedAuthor, False)
|
||||||
self.assertEqual(0, MockedAuthor.populate.call_count, 'A new author should not have been instantiated')
|
self.assertEqual(0, MockedAuthor.populate.call_count, 'A new author should not have been instantiated')
|
||||||
self.assertEqual(1, len(result.authors), 'There should only be one author')
|
self.assertEqual(1, len(result.authors_songs), 'There should only be one author')
|
||||||
|
Loading…
Reference in New Issue
Block a user