def test_process_author(self): """ Test that _process_authors works """ # GIVEN: A OpenLyric XML with authors and a mocked out manager with patch('openlp.plugins.songs.lib.openlyricsxml.Author'): mocked_manager = MagicMock() mocked_manager.get_object_filtered.return_value = None ol = OpenLyrics(mocked_manager) properties_xml = objectify.fromstring(author_xml) mocked_song = MagicMock() # WHEN: processing the author xml ol._process_authors(properties_xml, mocked_song) # THEN: add_author should have been called twice assert mocked_song.method_calls[0][1][1] == 'words+music' assert mocked_song.method_calls[1][1][1] == 'words'
def test_process_author(self): """ Test that _process_authors works """ # GIVEN: A OpenLyric XML with authors and a mocked out manager with patch('openlp.plugins.songs.lib.openlyricsxml.Author') as mocked_author: mocked_manager = MagicMock() mocked_manager.get_object_filtered.return_value = None ol = OpenLyrics(mocked_manager) properties_xml = objectify.fromstring(author_xml) mocked_song = MagicMock() # WHEN: processing the author xml ol._process_authors(properties_xml, mocked_song) # THEN: add_author should have been called twice self.assertEquals(mocked_song.method_calls[0][1][1], 'words+music') self.assertEquals(mocked_song.method_calls[1][1][1], 'words')