From ed488621aae576e24aeb56e63db003674e19a65e Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Fri, 25 Sep 2020 21:52:12 -0700 Subject: [PATCH] Fix problem with new MediaShout test --- openlp/plugins/songs/lib/importers/mediashout.py | 1 - tests/functional/openlp_plugins/songs/test_mediashout.py | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/openlp/plugins/songs/lib/importers/mediashout.py b/openlp/plugins/songs/lib/importers/mediashout.py index b12b7145c..ccfec945d 100644 --- a/openlp/plugins/songs/lib/importers/mediashout.py +++ b/openlp/plugins/songs/lib/importers/mediashout.py @@ -67,7 +67,6 @@ class MediaShoutImport(SongImport): songs = cursor.fetchall() self.import_wizard.progress_bar.setMaximum(len(songs)) for song in songs: - topics = [] if self.stop_import_flag: break cursor.execute('SELECT Type, Number, Text FROM Verses WHERE Record = ? ORDER BY Type, Number', diff --git a/tests/functional/openlp_plugins/songs/test_mediashout.py b/tests/functional/openlp_plugins/songs/test_mediashout.py index 33094fc32..a7a09fd9b 100644 --- a/tests/functional/openlp_plugins/songs/test_mediashout.py +++ b/tests/functional/openlp_plugins/songs/test_mediashout.py @@ -93,7 +93,7 @@ class TestMediaShoutImport(TestCase): importer = MediaShoutImport(MagicMock(), file_path='mediashout.db') mocked_cursor = MagicMock() mocked_cursor.fetchall.side_effect = [[song], [verse], [play_order], [theme], [group]] - mocked_cursor.tables.fetchone.return_value = True + mocked_cursor.tables.return_value.fetchone.return_value = True mocked_connection = MagicMock() mocked_connection.cursor.return_value = mocked_cursor mocked_pyodbc.connect.return_value = mocked_connection @@ -132,7 +132,7 @@ class TestMediaShoutImport(TestCase): importer = MediaShoutImport(MagicMock(), file_path='mediashout.db') mocked_cursor = MagicMock() mocked_cursor.fetchall.side_effect = [[song], [verse], [play_order]] - mocked_cursor.tables.fetchone.return_value = False + mocked_cursor.tables.return_value.fetchone.return_value = False mocked_connection = MagicMock() mocked_connection.cursor.return_value = mocked_cursor mocked_pyodbc.connect.return_value = mocked_connection @@ -149,7 +149,7 @@ class TestMediaShoutImport(TestCase): call('SELECT Type, Number, POrder FROM PlayOrder WHERE Record = ? ORDER BY POrder', 1.0) ] assert expected_execute_calls == mocked_cursor.execute.call_args_list - mocked_process_song.assert_called_once_with(song, [verse], [play_order]) + mocked_process_song.assert_called_once_with(song, [verse], [play_order], []) @patch('openlp.plugins.songs.lib.importers.mediashout.pyodbc') def test_do_import_breaks_on_stop(self, mocked_pyodbc):