forked from openlp/openlp
Merge branch 'fix-mediashout-test' into 'master'
Fix problem with new MediaShout test See merge request openlp/openlp!239
This commit is contained in:
commit
fef70e4af4
@ -67,7 +67,6 @@ class MediaShoutImport(SongImport):
|
|||||||
songs = cursor.fetchall()
|
songs = cursor.fetchall()
|
||||||
self.import_wizard.progress_bar.setMaximum(len(songs))
|
self.import_wizard.progress_bar.setMaximum(len(songs))
|
||||||
for song in songs:
|
for song in songs:
|
||||||
topics = []
|
|
||||||
if self.stop_import_flag:
|
if self.stop_import_flag:
|
||||||
break
|
break
|
||||||
cursor.execute('SELECT Type, Number, Text FROM Verses WHERE Record = ? ORDER BY Type, Number',
|
cursor.execute('SELECT Type, Number, Text FROM Verses WHERE Record = ? ORDER BY Type, Number',
|
||||||
|
@ -93,7 +93,7 @@ class TestMediaShoutImport(TestCase):
|
|||||||
importer = MediaShoutImport(MagicMock(), file_path='mediashout.db')
|
importer = MediaShoutImport(MagicMock(), file_path='mediashout.db')
|
||||||
mocked_cursor = MagicMock()
|
mocked_cursor = MagicMock()
|
||||||
mocked_cursor.fetchall.side_effect = [[song], [verse], [play_order], [theme], [group]]
|
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 = MagicMock()
|
||||||
mocked_connection.cursor.return_value = mocked_cursor
|
mocked_connection.cursor.return_value = mocked_cursor
|
||||||
mocked_pyodbc.connect.return_value = mocked_connection
|
mocked_pyodbc.connect.return_value = mocked_connection
|
||||||
@ -132,7 +132,7 @@ class TestMediaShoutImport(TestCase):
|
|||||||
importer = MediaShoutImport(MagicMock(), file_path='mediashout.db')
|
importer = MediaShoutImport(MagicMock(), file_path='mediashout.db')
|
||||||
mocked_cursor = MagicMock()
|
mocked_cursor = MagicMock()
|
||||||
mocked_cursor.fetchall.side_effect = [[song], [verse], [play_order]]
|
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 = MagicMock()
|
||||||
mocked_connection.cursor.return_value = mocked_cursor
|
mocked_connection.cursor.return_value = mocked_cursor
|
||||||
mocked_pyodbc.connect.return_value = mocked_connection
|
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)
|
call('SELECT Type, Number, POrder FROM PlayOrder WHERE Record = ? ORDER BY POrder', 1.0)
|
||||||
]
|
]
|
||||||
assert expected_execute_calls == mocked_cursor.execute.call_args_list
|
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')
|
@patch('openlp.plugins.songs.lib.importers.mediashout.pyodbc')
|
||||||
def test_do_import_breaks_on_stop(self, mocked_pyodbc):
|
def test_do_import_breaks_on_stop(self, mocked_pyodbc):
|
||||||
|
Loading…
Reference in New Issue
Block a user