From d6baae9f3445222e30a358fb9b9bbb525793dc76 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 15 Jan 2013 23:01:15 +0100 Subject: [PATCH] added test (not finished) --- openlp/core/lib/settings.py | 8 +++++--- .../functional/openlp_core_lib/test_settings.py | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 tests/functional/openlp_core_lib/test_settings.py diff --git a/openlp/core/lib/settings.py b/openlp/core/lib/settings.py index bebbee5b3..57b48ccbc 100644 --- a/openlp/core/lib/settings.py +++ b/openlp/core/lib/settings.py @@ -125,7 +125,7 @@ class Settings(QtCore.QSettings): u'general/display on monitor': True, u'general/audio start paused': True, # This defaults to yesterday in order to force the update check to run when you've never run it before. - u'general/last version test': datetime.datetime.now().date() - timedelta(days=1), + u'general/last version test': datetime.datetime.now().date() - datetime.timedelta(days=1), u'general/blank warning': False, u'players/background color': u'#000000', u'servicemanager/service theme': u'', @@ -209,7 +209,9 @@ class Settings(QtCore.QSettings): # HAS TO BE HERE. Should be FIXED. u'media/players': u'webkit', - u'media/override player': QtCore.Qt.Unchecked + u'media/override player': QtCore.Qt.Unchecked, + + u'images 1': u' ' } __file_path__ = u'' __obsolete_settings__ = { @@ -276,7 +278,7 @@ class Settings(QtCore.QSettings): ``defaultValue`` **Note**, do **not** use this. It is *only* for dynamic keys such as ``something %d``. """ - assert not(default_value is not None and key in Settings.__default_settings__) + if default_value is None: # if group() is not empty the group has not been specified together with the key. if self.group(): diff --git a/tests/functional/openlp_core_lib/test_settings.py b/tests/functional/openlp_core_lib/test_settings.py new file mode 100644 index 000000000..14606e78f --- /dev/null +++ b/tests/functional/openlp_core_lib/test_settings.py @@ -0,0 +1,16 @@ +""" +Package to test our customised Settings class. +""" +from unittest import TestCase + +from mock import MagicMock, patch + +from openlp.core.lib import Settings + + +class TestSettings(TestCase): + + def value_test(self): + #assert not(default_value is not None and key in Settings.__default_settings__) + pass +