Merge branch 'fix-mediashout-test' into 'master'

Fix problem with new MediaShout test

See merge request openlp/openlp!239
This commit is contained in:
Tim Bentley 2020-09-26 20:04:56 +00:00
commit fef70e4af4
2 changed files with 3 additions and 4 deletions

View File

@ -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',

View File

@ -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):