From 81c2f1a4b3bd069ce69d0a1d1e98492259585807 Mon Sep 17 00:00:00 2001 From: Philip Ridout Date: Sat, 16 Nov 2013 21:04:16 +0000 Subject: [PATCH] updated tests --- openlp/core/lib/filedialog.py | 2 +- tests/functional/openlp_core_lib/test_file_dialog.py | 12 +++++++----- tests/functional/openlp_core_lib/test_htmlbuilder.py | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/openlp/core/lib/filedialog.py b/openlp/core/lib/filedialog.py index 03a8b8c47..bac1b5ce2 100644 --- a/openlp/core/lib/filedialog.py +++ b/openlp/core/lib/filedialog.py @@ -36,7 +36,7 @@ from urllib import parse from PyQt4 import QtGui -from openlp.core.lib import UiStrings +from openlp.core.common import UiStrings log = logging.getLogger(__name__) diff --git a/tests/functional/openlp_core_lib/test_file_dialog.py b/tests/functional/openlp_core_lib/test_file_dialog.py index 0a5736ff0..f42a865d7 100644 --- a/tests/functional/openlp_core_lib/test_file_dialog.py +++ b/tests/functional/openlp_core_lib/test_file_dialog.py @@ -1,12 +1,11 @@ """ Package to test the openlp.core.lib.filedialog package. """ -import copy from unittest import TestCase -from mock import MagicMock, call, patch +from openlp.core.common import UiStrings from openlp.core.lib.filedialog import FileDialog -from openlp.core.lib.uistrings import UiStrings +from tests.functional import MagicMock, patch class TestFileDialog(TestCase): """ @@ -64,8 +63,11 @@ class TestFileDialog(TestCase): # THEN: os.path.exists should have been called with known args. QmessageBox.information should have been # called. The returned result should corrilate with the input. - self.mocked_os.path.exists.assert_has_calls([call('/Valid File'), call('/url%20encoded%20file%20%231'), - call('/url encoded file #1'), call('/non-existing'), call('/non-existing')]) + self.mocked_os.path.exists.assert_callde_with('/Valid File') + self.mocked_os.path.exists.assert_callde_with('/url%20encoded%20file%20%231') + self.mocked_os.path.exists.assert_callde_with('/url encoded file #1') + self.mocked_os.path.exists.assert_callde_with('/non-existing') + self.mocked_os.path.exists.assert_callde_with('/non-existing') self.mocked_qt_gui.QmessageBox.information.called_with(self.mocked_parent, UiStrings().FileNotFound, UiStrings().FileNotFoundMessage % '/non-existing') self.assertEqual(result, ['/Valid File', '/url encoded file #1'], 'The returned file list is incorrect') \ No newline at end of file diff --git a/tests/functional/openlp_core_lib/test_htmlbuilder.py b/tests/functional/openlp_core_lib/test_htmlbuilder.py index 0ffab5458..fafa277d7 100644 --- a/tests/functional/openlp_core_lib/test_htmlbuilder.py +++ b/tests/functional/openlp_core_lib/test_htmlbuilder.py @@ -3,13 +3,13 @@ Package to test the openlp.core.lib.htmlbuilder module. """ from unittest import TestCase -from mock import MagicMock, patch from PyQt4 import QtCore from openlp.core.lib.htmlbuilder import build_html, build_background_css, build_lyrics_css, build_lyrics_outline_css, \ build_lyrics_format_css, build_footer_css from openlp.core.lib.theme import HorizontalType, VerticalType +from tests.functional import MagicMock, patch HTML = """