forked from openlp/openlp
Tided up the test somewhat
This commit is contained in:
parent
401da98d7c
commit
4d0f9f3f91
@ -90,6 +90,14 @@ class TestSongShowPlusImport(TestCase):
|
|||||||
self.assertEquals(mocked_import_wizard.progress_bar.setMaximum.called, False,
|
self.assertEquals(mocked_import_wizard.progress_bar.setMaximum.called, False,
|
||||||
u'setMaxium on import_wizard.progress_bar should not have been called')
|
u'setMaxium on import_wizard.progress_bar should not have been called')
|
||||||
|
|
||||||
|
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
||||||
|
with patch(u'openlp.plugins.songs.lib.songshowplusimport.SongImport'):
|
||||||
|
mocked_manager = MagicMock()
|
||||||
|
mocked_import_wizard = MagicMock()
|
||||||
|
importer = SongShowPlusImport(mocked_manager)
|
||||||
|
importer.import_wizard = mocked_import_wizard
|
||||||
|
importer.stop_import_flag = True
|
||||||
|
|
||||||
# WHEN: Import source is an int
|
# WHEN: Import source is an int
|
||||||
importer.import_source = 0
|
importer.import_source = 0
|
||||||
|
|
||||||
@ -98,6 +106,14 @@ class TestSongShowPlusImport(TestCase):
|
|||||||
self.assertEquals(mocked_import_wizard.progress_bar.setMaximum.called, False,
|
self.assertEquals(mocked_import_wizard.progress_bar.setMaximum.called, False,
|
||||||
u'setMaxium on import_wizard.progress_bar should not have been called')
|
u'setMaxium on import_wizard.progress_bar should not have been called')
|
||||||
|
|
||||||
|
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
||||||
|
with patch(u'openlp.plugins.songs.lib.songshowplusimport.SongImport'):
|
||||||
|
mocked_manager = MagicMock()
|
||||||
|
mocked_import_wizard = MagicMock()
|
||||||
|
importer = SongShowPlusImport(mocked_manager)
|
||||||
|
importer.import_wizard = mocked_import_wizard
|
||||||
|
importer.stop_import_flag = True
|
||||||
|
|
||||||
# WHEN: Import source is a list
|
# WHEN: Import source is a list
|
||||||
importer.import_source = [u'List', u'of', u'files']
|
importer.import_source = [u'List', u'of', u'files']
|
||||||
|
|
||||||
@ -107,7 +123,7 @@ class TestSongShowPlusImport(TestCase):
|
|||||||
u'doImport should return None when import_source is a list and stop_import_flag is True')
|
u'doImport should return None when import_source is a list and stop_import_flag is True')
|
||||||
mocked_import_wizard.progress_bar.setMaximum.assert_called_with(len(importer.import_source))
|
mocked_import_wizard.progress_bar.setMaximum.assert_called_with(len(importer.import_source))
|
||||||
|
|
||||||
def toOpenLPVerseTag_test(self):
|
def to_openlp_verse_tag_test(self):
|
||||||
"""
|
"""
|
||||||
Test to_openlp_verse_tag method
|
Test to_openlp_verse_tag method
|
||||||
"""
|
"""
|
||||||
@ -134,6 +150,11 @@ class TestSongShowPlusImport(TestCase):
|
|||||||
u'SongShowPlusImport.to_openlp_verse_tag should return "%s" when called with "%s"'
|
u'SongShowPlusImport.to_openlp_verse_tag should return "%s" when called with "%s"'
|
||||||
% (openlp_tag, original_tag))
|
% (openlp_tag, original_tag))
|
||||||
|
|
||||||
|
# GIVEN: A mocked out SongImport class, and a mocked out "manager"
|
||||||
|
with patch(u'openlp.plugins.songs.lib.songshowplusimport.SongImport'):
|
||||||
|
mocked_manager = MagicMock()
|
||||||
|
importer = SongShowPlusImport(mocked_manager)
|
||||||
|
|
||||||
# WHEN: Supplied with the following arguments replicating a verse order being added
|
# WHEN: Supplied with the following arguments replicating a verse order being added
|
||||||
test_values = [(u'Verse 1', VerseType.tags[VerseType.Verse] + u'1'),
|
test_values = [(u'Verse 1', VerseType.tags[VerseType.Verse] + u'1'),
|
||||||
(u'Verse 2', VerseType.tags[VerseType.Verse] + u'2'),
|
(u'Verse 2', VerseType.tags[VerseType.Verse] + u'2'),
|
||||||
|
Loading…
Reference in New Issue
Block a user