Make settings from qute://settings persistent

This commit is contained in:
Florian Bruhin 2017-07-10 18:04:39 +02:00
parent d4da82805f
commit 135fb042da
2 changed files with 15 additions and 2 deletions

View File

@ -457,7 +457,7 @@ def _qute_settings_set(url):
return 'text/html', b'error: ' + msg.encode('utf-8')
try:
config.instance.set_str(option, value)
config.instance.set_str(option, value, save_yaml=True)
return 'text/html', b'ok'
except configexc.Error as e:
message.error(str(e))
@ -467,7 +467,6 @@ def _qute_settings_set(url):
@add_handler('settings')
def qute_settings(url):
"""Handler for qute://settings. View/change qute configuration."""
# FIXME:conf add a test for this
if url.path() == '/set':
return _qute_settings_set(url)

View File

@ -306,3 +306,17 @@ def test_loading_empty_session(tmpdir, request, quteproc_new):
quteproc_new.send_cmd(':quit')
quteproc_new.wait_for_quit()
def test_qute_settings_persistence(short_tmpdir, request, quteproc_new):
"""Make sure settings from qute://settings are persistent."""
args = _base_args(request.config) + ['--basedir', str(short_tmpdir)]
quteproc_new.start(args)
quteproc_new.open_path('qute://settings/set?option=ignore_case&value=always')
assert quteproc_new.get_setting('ignore_case') == 'always'
quteproc_new.send_cmd(':quit')
quteproc_new.wait_for_quit()
quteproc_new.start(args)
assert quteproc_new.get_setting('ignore_case') == 'always'