forked from openlp/openlp
finished up with tests
This commit is contained in:
parent
34a5689499
commit
83b30799ca
@ -20,7 +20,7 @@
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
"""
|
||||
The :mod:`http` module enables OpenLP to retrieve scripture from bible websites.
|
||||
The :mod:`biblegateway` module enables OpenLP to retrieve scripture from http://biblegateway.com.
|
||||
"""
|
||||
import logging
|
||||
import socket
|
||||
@ -32,7 +32,7 @@ from bs4 import BeautifulSoup, NavigableString, Tag
|
||||
from openlp.core.common import RegistryProperties
|
||||
from openlp.core.lib.webpagereader import get_web_page
|
||||
from openlp.plugins.bibles.lib import SearchResults
|
||||
from openlp.plugins.bibles.lib.importers.http import get_soup_for_bible_ref, send_error_message
|
||||
from openlp.plugins.bibles.lib.http import get_soup_for_bible_ref, send_error_message
|
||||
|
||||
UGLY_CHARS = {
|
||||
'\u2014': ' - ',
|
||||
|
@ -20,7 +20,7 @@
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
"""
|
||||
The :mod:`http` module enables OpenLP to retrieve scripture from bible websites.
|
||||
The :mod:`bibleserver` module enables OpenLP to retrieve scripture from http://bibleserver.com.
|
||||
"""
|
||||
import logging
|
||||
import re
|
||||
|
@ -20,7 +20,7 @@
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
"""
|
||||
The :mod:`http` module enables OpenLP to retrieve scripture from bible websites.
|
||||
The :mod:`crosswalk` module enables OpenLP to retrieve scripture from www.biblestudytools.com.
|
||||
"""
|
||||
import logging
|
||||
import re
|
||||
@ -30,7 +30,7 @@ import urllib.error
|
||||
|
||||
from openlp.core.common import RegistryProperties
|
||||
from openlp.plugins.bibles.lib import SearchResults
|
||||
from openlp.plugins.bibles.lib.importers.http import get_soup_for_bible_ref, send_error_message
|
||||
from openlp.plugins.bibles.lib.http import get_soup_for_bible_ref, send_error_message
|
||||
|
||||
FIX_PUNKCTUATION_REGEX = re.compile(r'[ ]+([.,;])')
|
||||
REDUCE_SPACES_REGEX = re.compile(r'[ ]{2,}')
|
||||
|
@ -27,7 +27,7 @@ from openlp.core.common import RegistryProperties, AppLocation, Settings, transl
|
||||
from openlp.plugins.bibles.lib import parse_reference, LanguageSelection
|
||||
from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta
|
||||
from .importers.csvbible import CSVBible
|
||||
from .importers.http import HTTPBible
|
||||
from .http import HTTPBible
|
||||
from .importers.opensong import OpenSongBible
|
||||
from .importers.osis import OSISBible
|
||||
from .importers.zefania import ZefaniaBible
|
||||
|
@ -20,41 +20,13 @@
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
"""
|
||||
This module contains tests for the http module of the Bibles plugin.
|
||||
This module contains tests for the bibleserver module of the Bibles plugin.
|
||||
"""
|
||||
from unittest import TestCase
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
from tests.functional import patch, MagicMock
|
||||
from openlp.plugins.bibles.lib.importers.http import BSExtract
|
||||
|
||||
# TODO: Items left to test
|
||||
# BGExtract
|
||||
# __init__
|
||||
# _remove_elements
|
||||
# _extract_verse
|
||||
# _clean_soup
|
||||
# _extract_verses
|
||||
# _extract_verses_old
|
||||
# get_bible_chapter
|
||||
# get_books_from_http
|
||||
# _get_application
|
||||
# CWExtract
|
||||
# __init__
|
||||
# get_bible_chapter
|
||||
# get_books_from_http
|
||||
# _get_application
|
||||
# HTTPBible
|
||||
# __init__
|
||||
# do_import
|
||||
# get_verses
|
||||
# get_chapter
|
||||
# get_books
|
||||
# get_chapter_count
|
||||
# get_verse_count
|
||||
# _get_application
|
||||
# get_soup_for_bible_ref
|
||||
# send_error_message
|
||||
from openlp.plugins.bibles.lib.importers.bibleserver import BSExtract
|
||||
|
||||
|
||||
class TestBSExtract(TestCase):
|
||||
@ -68,11 +40,12 @@ class TestBSExtract(TestCase):
|
||||
# get_books_from_http
|
||||
# _get_application
|
||||
def setUp(self):
|
||||
self.get_soup_for_bible_ref_patcher = patch('openlp.plugins.bibles.lib.importers.http.get_soup_for_bible_ref')
|
||||
self.log_patcher = patch('openlp.plugins.bibles.lib.importers.http.log')
|
||||
self.send_error_message_patcher = patch('openlp.plugins.bibles.lib.importers.http.send_error_message')
|
||||
self.socket_patcher = patch('openlp.plugins.bibles.lib.importers.http.socket')
|
||||
self.urllib_patcher = patch('openlp.plugins.bibles.lib.importers.http.urllib')
|
||||
self.get_soup_for_bible_ref_patcher = patch(
|
||||
'openlp.plugins.bibles.lib.importers.bibleserver.get_soup_for_bible_ref')
|
||||
self.log_patcher = patch('openlp.plugins.bibles.lib.importers.bibleserver.log')
|
||||
self.send_error_message_patcher = patch('openlp.plugins.bibles.lib.importers.bibleserver.send_error_message')
|
||||
self.socket_patcher = patch('openlp.plugins.bibles.lib.http.socket')
|
||||
self.urllib_patcher = patch('openlp.plugins.bibles.lib.importers.bibleserver.urllib')
|
||||
|
||||
self.mock_get_soup_for_bible_ref = self.get_soup_for_bible_ref_patcher.start()
|
||||
self.mock_log = self.log_patcher.start()
|
Loading…
Reference in New Issue
Block a user