Migrate new tests to mixins

This commit is contained in:
Tim Bentley 2014-03-15 06:29:41 +00:00
parent 9cf3428542
commit 86bbc0d66c
2 changed files with 8 additions and 13 deletions

View File

@ -29,8 +29,6 @@
"""
Functional tests to test the Bible Manager class and related methods.
"""
import os
from tempfile import mkstemp
from unittest import TestCase
from openlp.core.common import Registry, Settings
@ -38,16 +36,16 @@ from openlp.plugins.bibles.lib import BibleManager, LanguageSelection
from tests.interfaces import MagicMock, patch
from tests.utils.constants import TEST_RESOURCES_PATH
from tests.helpers.testmixin import TestMixin
class TestBibleManager(TestCase):
class TestBibleManager(TestCase, TestMixin):
def setUp(self):
"""
Set up the environment for testing bible queries with 1 Timothy 3
"""
fd, self.ini_file = mkstemp('.ini')
Settings().set_filename(self.ini_file)
self.build_settings()
Registry.create()
Registry().register('service_list', MagicMock())
Registry().register('application', MagicMock())
@ -75,7 +73,7 @@ class TestBibleManager(TestCase):
"""
Delete all the C++ objects at the end so that we don't have a segfault
"""
os.unlink(self.ini_file)
self.destroy_settings()
def get_books_test(self):
"""

View File

@ -29,9 +29,6 @@
"""
This module contains tests for the lib submodule of the Bibles plugin.
"""
import os
from tempfile import mkstemp
from unittest import TestCase
from tests.interfaces import MagicMock, patch
@ -39,16 +36,16 @@ from openlp.core.common import Registry, Settings
from openlp.plugins.bibles.lib import BibleManager, parse_reference, LanguageSelection
from tests.utils.constants import TEST_RESOURCES_PATH
from tests.helpers.testmixin import TestMixin
class TestBibleManager(TestCase):
class TestBibleManager(TestCase, TestMixin):
def setUp(self):
"""
Set up the environment for testing bible parse reference
"""
fd, self.ini_file = mkstemp('.ini')
Settings().set_filename(self.ini_file)
self.build_settings()
Registry.create()
Registry().register('service_list', MagicMock())
Registry().register('application', MagicMock())
@ -76,7 +73,7 @@ class TestBibleManager(TestCase):
"""
Delete all the C++ objects at the end so that we don't have a segfault
"""
os.unlink(self.ini_file)
self.destroy_settings()
def parse_reference_one_test(self):
"""