- Fixed tests for creating creator lists

This commit is contained in:
Olli Suutari 2016-10-04 11:43:52 +03:00
parent ce4d8224a2
commit 400595adf5
1 changed files with 19 additions and 31 deletions

View File

@ -689,10 +689,7 @@ class TestLib(TestCase):
"""
Test the create_separated_list function with a list consisting of only one entry
"""
with patch('openlp.core.lib.Qt') as mocked_qt:
# GIVEN: A list with a string and the mocked Qt module.
mocked_qt.PYQT_VERSION_STR = '4.8'
mocked_qt.qVersion.return_value = '4.7'
# GIVEN: A list with a string.
string_list = ['Author 1']
# WHEN: We get a string build from the entries it the list and a separator.
@ -705,11 +702,7 @@ class TestLib(TestCase):
"""
Test the create_separated_list function with a list of two entries
"""
with patch('openlp.core.lib.Qt') as mocked_qt, patch('openlp.core.lib.translate') as mocked_translate:
# GIVEN: A list of strings and the mocked Qt module.
mocked_qt.PYQT_VERSION_STR = '4.8'
mocked_qt.qVersion.return_value = '4.7'
mocked_translate.return_value = '%s and %s'
# GIVEN: A list with two strings.
string_list = ['Author 1', 'Author 2']
# WHEN: We get a string build from the entries it the list and a seperator.
@ -722,12 +715,7 @@ class TestLib(TestCase):
"""
Test the create_separated_list function with a list of three items
"""
with patch('openlp.core.lib.Qt') as mocked_qt, patch('openlp.core.lib.translate') as mocked_translate:
# GIVEN: A list with a string and the mocked Qt module.
mocked_qt.PYQT_VERSION_STR = '4.8'
mocked_qt.qVersion.return_value = '4.7'
# Always return the untranslated string.
mocked_translate.side_effect = lambda module, string_to_translate, comment: string_to_translate
# GIVEN: A list with three strings.
string_list = ['Author 1', 'Author 2', 'Author 3']
# WHEN: We get a string build from the entries it the list and a seperator.