Merge branch 'bible_search_from_gui_not_working' into 'master'

Bible search from gui not working

Closes #281 and #282

See merge request openlp/openlp!36
This commit is contained in:
Tomas Groth 2019-10-09 08:27:28 +00:00
commit 41d7166b89
3 changed files with 15 additions and 8 deletions

View File

@ -37,7 +37,7 @@ from openlp.core.common.registry import Registry
from openlp.core.lib.ui import critical_error_message_box
from openlp.plugins.bibles.lib import SearchResults
from openlp.plugins.bibles.lib.bibleimport import BibleImport
from openlp.plugins.bibles.lib.db import BibleDB, BiblesResourcesDB, Book
from openlp.plugins.bibles.lib.db import BibleDB, BiblesResourcesDB
CLEANER_REGEX = re.compile(r'&nbsp;|<br />|\'\+\'')
@ -709,13 +709,6 @@ class HTTPBible(BibleImport, RegistryProperties):
handler = BSExtract()
return handler.get_bible_chapter(self.download_name, book, chapter)
def get_books(self):
"""
Return the list of books.
"""
log.debug('HTTPBible.get_books("{name}")'.format(name=Book.name))
return self.get_all_objects(Book, order_by_ref=Book.id)
def get_chapter_count(self, book):
"""
Return the number of chapters in a particular book.

View File

@ -121,3 +121,14 @@ class TestBibleManager(TestCase, TestMixin):
results = parse_reference('1 Timothy 1:3-end', self.manager.db_cache['tests'], MagicMock(), 54)
# THEN a verse array should be returned
assert [(54, 1, 3, -1)] == results, "The bible verses should matches the expected results"
def test_parse_reference_six(self):
"""
Test the parse_reference method with 1 Timothy 1:3-end without a bible ref id to match
how the GUI does the search. This is logged in issue #282
"""
# GIVEN given a bible in the bible manager
# WHEN asking to parse the bible reference in Language 0 (english)
results = parse_reference('1 Timothy 1:3-end', self.manager.db_cache['tests'], 0)
# THEN a verse array should be returned
assert [(54, 1, 3, -1)] == results, "The bible verses should matches the expected results"

View File

@ -53,6 +53,8 @@ class TestMediaClipSelectorForm(TestCase, TestMixin):
# Mock VLC so we don't actually use it
self.vlc_patcher = patch('openlp.plugins.media.forms.mediaclipselectorform.get_vlc')
self.vlc_patcher.start()
self.timer_patcher = patch('openlp.plugins.media.forms.mediaclipselectorform.QtCore.QTimer')
self.timer_patcher.start()
Registry().register('application', self.app)
# Mock the media item
self.mock_media_item = MagicMock()
@ -71,6 +73,7 @@ class TestMediaClipSelectorForm(TestCase, TestMixin):
"""
del self.form
self.vlc_patcher.stop()
self.timer_patcher.stop()
del self.main_window
def test_basic(self):