This commit is contained in:
Samuel Mehrbrodt 2014-07-03 19:57:13 +02:00
parent d59be6ca82
commit 3b7d5f53ba
4 changed files with 16 additions and 12 deletions

View File

@ -27,5 +27,5 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
The :mod:`~openlp.plugins.songs.lib.import` module contains a importers for the Songs plugin.
The :mod:`~openlp.plugins.songs.lib.import` module contains importers for the Songs plugin.
"""

View File

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################

View File

@ -156,9 +156,9 @@ class TestWorshipCenterProSongImport(TestCase):
"""
# GIVEN: A mocked out SongImport class, a mocked out pyodbc module, a mocked out translate method,
# a mocked "manager" and a mocked out log_error method.
with patch('openlp.plugins.songs.lib.worshipcenterproimport.SongImport'), \
patch('openlp.plugins.songs.lib.worshipcenterproimport.pyodbc.connect') as mocked_pyodbc_connect, \
patch('openlp.plugins.songs.lib.worshipcenterproimport.translate') as mocked_translate:
with patch('openlp.plugins.songs.lib.songimport.worshipcenterproimport.SongImport'), \
patch('openlp.plugins.songs.lib.songimport.worshipcenterproimport.pyodbc.connect') as mocked_pyodbc_connect, \
patch('openlp.plugins.songs.lib.songimport.worshipcenterproimport.translate') as mocked_translate:
mocked_manager = MagicMock()
mocked_log_error = MagicMock()
mocked_translate.return_value = 'Translated Text'
@ -185,9 +185,9 @@ class TestWorshipCenterProSongImport(TestCase):
"""
# GIVEN: A mocked out SongImport class, a mocked out pyodbc module with a simulated recordset, a mocked out
# translate method, a mocked "manager", add_verse method & mocked_finish method.
with patch('openlp.plugins.songs.lib.worshipcenterproimport.SongImport'), \
patch('openlp.plugins.songs.lib.worshipcenterproimport.pyodbc') as mocked_pyodbc, \
patch('openlp.plugins.songs.lib.worshipcenterproimport.translate') as mocked_translate:
with patch('openlp.plugins.songs.lib.songimport.worshipcenterproimport.SongImport'), \
patch('openlp.plugins.songs.lib.songimport.worshipcenterproimport.pyodbc') as mocked_pyodbc, \
patch('openlp.plugins.songs.lib.songimport.worshipcenterproimport.translate') as mocked_translate:
mocked_manager = MagicMock()
mocked_import_wizard = MagicMock()
mocked_add_verse = MagicMock()

View File

@ -51,14 +51,18 @@ class SongImportTestHelper(TestCase):
Patch and set up the mocks required.
"""
self.add_copyright_patcher = patch(
'openlp.plugins.songs.lib.songimport.%s.%s.add_copyright' % (self.importer_module_name, self.importer_class_name))
'openlp.plugins.songs.lib.songimport.%s.%s.add_copyright' % (self.importer_module_name,
self.importer_class_name))
self.add_verse_patcher = patch(
'openlp.plugins.songs.lib.songimport.%s.%s.add_verse' % (self.importer_module_name, self.importer_class_name))
'openlp.plugins.songs.lib.songimport.%s.%s.add_verse' % (self.importer_module_name,
self.importer_class_name))
self.finish_patcher = patch(
'openlp.plugins.songs.lib.songimport.%s.%s.finish' % (self.importer_module_name, self.importer_class_name))
self.add_author_patcher = patch(
'openlp.plugins.songs.lib.songimport.%s.%s.add_author' % (self.importer_module_name, self.importer_class_name))
self.song_import_patcher = patch('openlp.plugins.songs.lib.songimport.%s.SongImport' % self.importer_module_name)
'openlp.plugins.songs.lib.songimport.%s.%s.add_author' % (self.importer_module_name,
self.importer_class_name))
self.song_import_patcher = patch('openlp.plugins.songs.lib.songimport.%s.SongImport' %
self.importer_module_name)
self.mocked_add_copyright = self.add_copyright_patcher.start()
self.mocked_add_verse = self.add_verse_patcher.start()
self.mocked_finish = self.finish_patcher.start()