forked from openlp/openlp
Tweeked test to use a call list
This commit is contained in:
parent
05f4f2d72e
commit
67ab508286
@ -5,7 +5,7 @@ from unittest import TestCase
|
|||||||
|
|
||||||
from openlp.core.common import UiStrings
|
from openlp.core.common import UiStrings
|
||||||
from openlp.core.lib.filedialog import FileDialog
|
from openlp.core.lib.filedialog import FileDialog
|
||||||
from tests.functional import MagicMock, patch
|
from tests.functional import MagicMock, call, patch
|
||||||
|
|
||||||
|
|
||||||
class TestFileDialog(TestCase):
|
class TestFileDialog(TestCase):
|
||||||
@ -65,11 +65,9 @@ class TestFileDialog(TestCase):
|
|||||||
|
|
||||||
# THEN: os.path.exists should have been called with known args. QmessageBox.information should have been
|
# THEN: os.path.exists should have been called with known args. QmessageBox.information should have been
|
||||||
# called. The returned result should correlate with the input.
|
# called. The returned result should correlate with the input.
|
||||||
self.mocked_os.path.exists.assert_any_call('/Valid File')
|
call_list = [call('/Valid File'), call('/url%20encoded%20file%20%231'), call('/url encoded file #1'),
|
||||||
self.mocked_os.path.exists.assert_any_call('/url%20encoded%20file%20%231')
|
call('/non-existing'), call('/non-existing')]
|
||||||
self.mocked_os.path.exists.assert_any_call('/url encoded file #1')
|
self.mocked_os.path.exists.assert_has_calls(call_list)
|
||||||
self.mocked_os.path.exists.assert_any_call('/non-existing')
|
|
||||||
self.mocked_os.path.exists.assert_any_call('/non-existing')
|
|
||||||
self.mocked_qt_gui.QmessageBox.information.called_with(self.mocked_parent, UiStrings().FileNotFound,
|
self.mocked_qt_gui.QmessageBox.information.called_with(self.mocked_parent, UiStrings().FileNotFound,
|
||||||
UiStrings().FileNotFoundMessage % '/non-existing')
|
UiStrings().FileNotFoundMessage % '/non-existing')
|
||||||
self.assertEqual(result, ['/Valid File', '/url encoded file #1'], 'The returned file list is incorrect')
|
self.assertEqual(result, ['/Valid File', '/url encoded file #1'], 'The returned file list is incorrect')
|
||||||
|
Loading…
Reference in New Issue
Block a user