This commit is contained in:
Samuel Mehrbrodt 2014-07-04 11:36:54 +02:00
parent f089e7522e
commit 0fb445e117

View File

@ -42,25 +42,22 @@ class SongImportTestHelper(TestCase):
"""
def __init__(self, *args, **kwargs):
super(SongImportTestHelper, self).__init__(*args, **kwargs)
self.importer_module = __import__(
'openlp.plugins.songs.lib.importers.%s' % self.importer_module_name, fromlist=[self.importer_class_name])
self.importer_module = __import__('openlp.plugins.songs.lib.importers.%s' %
self.importer_module_name, fromlist=[self.importer_class_name])
self.importer_class = getattr(self.importer_module, self.importer_class_name)
def setUp(self):
"""
Patch and set up the mocks required.
"""
self.add_copyright_patcher = patch(
'openlp.plugins.songs.lib.importers.%s.%s.add_copyright' % (self.importer_module_name,
self.importer_class_name))
self.add_verse_patcher = patch(
'openlp.plugins.songs.lib.importers.%s.%s.add_verse' % (self.importer_module_name,
self.importer_class_name))
self.finish_patcher = patch(
'openlp.plugins.songs.lib.importers.%s.%s.finish' % (self.importer_module_name, self.importer_class_name))
self.add_author_patcher = patch(
'openlp.plugins.songs.lib.importers.%s.%s.add_author' % (self.importer_module_name,
self.importer_class_name))
self.add_copyright_patcher = patch('openlp.plugins.songs.lib.importers.%s.%s.add_copyright' %
(self.importer_module_name, self.importer_class_name))
self.add_verse_patcher = patch('openlp.plugins.songs.lib.importers.%s.%s.add_verse' %
(self.importer_module_name, self.importer_class_name))
self.finish_patcher = patch('openlp.plugins.songs.lib.importers.%s.%s.finish' %
(self.importer_module_name, self.importer_class_name))
self.add_author_patcher = patch('openlp.plugins.songs.lib.importers.%s.%s.add_author' %
(self.importer_module_name, self.importer_class_name))
self.song_import_patcher = patch('openlp.plugins.songs.lib.importers.%s.SongImport' %
self.importer_module_name)
self.mocked_add_copyright = self.add_copyright_patcher.start()