Cleanup BibleImportForm tests

This commit is contained in:
Raoul Snyman 2017-03-22 15:17:43 -07:00
parent 05a39cb7ea
commit cd7b18ef30

View File

@ -23,14 +23,14 @@
Package to test the openlp.plugins.bibles.forms.bibleimportform package. Package to test the openlp.plugins.bibles.forms.bibleimportform package.
""" """
from unittest import TestCase from unittest import TestCase
from unittest.mock import MagicMock, patch
from PyQt5 import QtWidgets from PyQt5 import QtWidgets
from openlp.core.common import Registry from openlp.core.common import Registry
import openlp.plugins.bibles.forms.bibleimportform as bibleimportform from openlp.plugins.bibles.forms.bibleimportform import BibleImportForm, PYSWORD_AVAILABLE
from tests.helpers.testmixin import TestMixin from tests.helpers.testmixin import TestMixin
from tests.functional import MagicMock, patch
class TestBibleImportForm(TestCase, TestMixin): class TestBibleImportForm(TestCase, TestMixin):
@ -46,15 +46,16 @@ class TestBibleImportForm(TestCase, TestMixin):
self.setup_application() self.setup_application()
self.main_window = QtWidgets.QMainWindow() self.main_window = QtWidgets.QMainWindow()
Registry().register('main_window', self.main_window) Registry().register('main_window', self.main_window)
bibleimportform.PYSWORD_AVAILABLE = False PYSWORD_AVAILABLE = False
self.form = bibleimportform.BibleImportForm(self.main_window, MagicMock(), MagicMock()) self.mocked_manager = MagicMock()
self.form = BibleImportForm(self.main_window, self.mocked_manager, MagicMock())
# def tearDown(self): def tearDown(self):
# """ """
# Delete all the C++ objects at the end so that we don't have a segfault Delete all the C++ objects at the end so that we don't have a segfault
# """ """
# del self.form del self.form
# del self.main_window del self.main_window
@patch('openlp.plugins.bibles.forms.bibleimportform.CWExtract.get_bibles_from_http') @patch('openlp.plugins.bibles.forms.bibleimportform.CWExtract.get_bibles_from_http')
@patch('openlp.plugins.bibles.forms.bibleimportform.BGExtract.get_bibles_from_http') @patch('openlp.plugins.bibles.forms.bibleimportform.BGExtract.get_bibles_from_http')