updated tests

This commit is contained in:
Philip Ridout 2013-11-16 21:04:16 +00:00
parent c41842125d
commit 81c2f1a4b3
3 changed files with 9 additions and 7 deletions

View File

@ -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__)

View File

@ -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')

View File

@ -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 = """