forked from openlp/openlp
fixes bug1416703 by implementing a function to do the conversion
Fixes: https://launchpad.net/bugs/1416703
This commit is contained in:
parent
f6de8a4f7a
commit
126873ddaa
@ -360,7 +360,7 @@ class Settings(QtCore.QSettings):
|
||||
|
||||
:param default_values: A dict with setting keys and their default values.
|
||||
"""
|
||||
Settings.__default_settings__ = dict(list(default_values.items()) + list(Settings.__default_settings__.items()))
|
||||
Settings.__default_settings__.update(default_values)
|
||||
|
||||
@staticmethod
|
||||
def set_filename(ini_file):
|
||||
|
@ -123,9 +123,17 @@ class TestSettings(TestCase, TestMixin):
|
||||
self.assertEqual(str(cm.exception), "'core/does not exists'", 'We should get an exception')
|
||||
|
||||
def extend_default_settings_test(self):
|
||||
with patch.dict(Settings() .__default_settings__, {1: 2, 3: 4}, clear=True):
|
||||
Settings().extend_default_settings({'a': 'b', 'c': 'd'})
|
||||
"""
|
||||
Test that the extend_default_settings method extends the default settings
|
||||
"""
|
||||
# GIVEN: A patched __default_settings__ dictionary
|
||||
with patch.dict(Settings.__default_settings__,
|
||||
{'test/setting 1': 1, 'test/setting 2': 2, 'test/setting 3': 3}, True):
|
||||
|
||||
ds = Settings().__default_settings__
|
||||
# WHEN: Calling extend_default_settings
|
||||
Settings.extend_default_settings({'test/setting 3': 4, 'test/extended 1': 1, 'test/extended 2': 2})
|
||||
|
||||
self.assertDictEqual(ds, {1: 2, 3: 4, 'a': 'b', 'c': 'd'})
|
||||
# THEN: The _default_settings__ dictionary_ should have the new keys
|
||||
self.assertEqual(
|
||||
Settings.__default_settings__, {'test/setting 1': 1, 'test/setting 2': 2, 'test/setting 3': 4,
|
||||
'test/extended 1': 1, 'test/extended 2': 2})
|
||||
|
Loading…
Reference in New Issue
Block a user