openlp/tests/interfaces/openlp_plugins/bibles/test_lib_http.py

74 lines
2.4 KiB
Python
Raw Normal View History

2013-06-15 20:51:11 +00:00
"""
Package to test the openlp.plugin.bible.lib.https package.
"""
from unittest import TestCase
2013-06-16 07:54:16 +00:00
from mock import MagicMock
2013-06-15 20:51:11 +00:00
from openlp.core.lib import Registry
2013-06-16 07:54:16 +00:00
from openlp.plugins.bibles.lib.http import BGExtract, CWExtract
2013-06-15 20:51:11 +00:00
class TestBibleHTTP(TestCase):
def setUp(self):
"""
Set up the Registry
"""
Registry.create()
Registry().register(u'service_list', MagicMock())
Registry().register(u'application', MagicMock())
2013-06-16 07:54:16 +00:00
def bible_gateway_extract_books_test(self):
2013-06-15 20:51:11 +00:00
"""
2013-06-16 07:54:16 +00:00
Test the Bible Gateway retrieval of book list for NIV bible
2013-06-15 20:51:11 +00:00
"""
# GIVEN: A new Bible Gateway extraction class
handler = BGExtract()
# WHEN: The Books list is called
books = handler.get_books_from_http(u'NIV')
# THEN: We should get back a valid service item
2013-06-16 07:54:16 +00:00
assert len(books) == 66, u'The bible should not have had any books added or removed'
def bible_gateway_extract_verse_test(self):
"""
Test the Bible Gateway retrieval of verse list for NIV bible John 3
"""
# GIVEN: A new Bible Gateway extraction class
handler = BGExtract()
# WHEN: The Books list is called
results = handler.get_bible_chapter(u'NIV', u'John', 3)
# THEN: We should get back a valid service item
2013-06-16 08:28:38 +00:00
assert len(results.verselist) == 36, u'The book of John should not have had any verses added or removed'
2013-06-16 07:54:16 +00:00
def crosswalk_extract_books_test(self):
"""
Test Crosswalk retrieval of book list for NIV bible
"""
# GIVEN: A new Bible Gateway extraction class
handler = CWExtract()
# WHEN: The Books list is called
books = handler.get_books_from_http(u'niv')
# THEN: We should get back a valid service item
assert len(books) == 66, u'The bible should not have had any books added or removed'
def crosswalk_extract_verse_test(self):
"""
2013-06-16 13:36:09 +00:00
Test Crosswalk retrieval of verse list for NIV bible John 3
2013-06-16 07:54:16 +00:00
"""
# GIVEN: A new Bible Gateway extraction class
handler = CWExtract()
# WHEN: The Books list is called
results = handler.get_bible_chapter(u'niv', u'john', 3)
# THEN: We should get back a valid service item
2013-06-16 08:28:38 +00:00
assert len(results.verselist) == 36, u'The book of John should not have had any verses added or removed'