openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #33339
[Merge] lp:~lambda-calculist/openlp/run_search into lp:openlp
Kyle Nweeia has proposed merging lp:~lambda-calculist/openlp/run_search into lp:openlp.
Commit message:
Fixed bug #1678632 "SongSelect Importer Infinite Loop."
Requested reviews:
Tomas Groth (tomasgroth)
For more details, see:
https://code.launchpad.net/~lambda-calculist/openlp/run_search/+merge/362258
--
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/plugins/songs/lib/songselect.py'
--- openlp/plugins/songs/lib/songselect.py 2018-10-26 23:15:31 +0000
+++ openlp/plugins/songs/lib/songselect.py 2019-01-25 16:35:54 +0000
@@ -171,6 +171,7 @@
callback(song)
songs.append(song)
if len(songs) >= max_results:
+ self.run_search = False
break
current_page += 1
return songs
=== modified file 'tests/functional/openlp_plugins/songs/test_songselect.py'
--- tests/functional/openlp_plugins/songs/test_songselect.py 2018-01-04 06:10:20 +0000
+++ tests/functional/openlp_plugins/songs/test_songselect.py 2019-01-25 16:35:54 +0000
@@ -285,10 +285,10 @@
# WHEN: The search method is called
results = importer.search('text', 2, mock_callback)
- # THEN: callback was called twice, open was called twice, find_all was called twice, max results returned
+ # THEN: callback was called twice, open was called once, find_all was called once, max results returned
assert 2 == mock_callback.call_count, 'callback should have been called twice'
- assert 2 == mocked_opener.open.call_count, 'open should have been called twice'
- assert 2 == mocked_results_page.find_all.call_count, 'find_all should have been called twice'
+ assert 1 == mocked_opener.open.call_count, 'open should have been called once'
+ assert 1 == mocked_results_page.find_all.call_count, 'find_all should have been called once'
mocked_results_page.find_all.assert_called_with('div', 'song-result')
expected_list = [{'title': 'Title 1', 'authors': ['James', 'John'], 'link': BASE_URL + '/url1'},
{'title': 'Title 2', 'authors': ['Philip'], 'link': BASE_URL + '/url2'}]
Follow ups