diff --git a/tests/integration/quteprocess.py b/tests/integration/quteprocess.py index 6154cfa5f..03616301b 100644 --- a/tests/integration/quteprocess.py +++ b/tests/integration/quteprocess.py @@ -340,6 +340,8 @@ class QuteProc(testprocess.Process): return msg.message.split(' = ')[1] def set_setting(self, sect, opt, value): + # " in a value should be treated literally, so escape it + value = value.replace('"', '\\"') self.send_cmd(':set "{}" "{}" "{}"'.format(sect, opt, value)) self.wait_for(category='config', message='Config option changed: *') diff --git a/tests/integration/test_quteprocess.py b/tests/integration/test_quteprocess.py index 7698e1a07..5110324ef 100644 --- a/tests/integration/test_quteprocess.py +++ b/tests/integration/test_quteprocess.py @@ -195,3 +195,13 @@ class TestClickElement: ]) def test_xpath_escape(string, expected): assert quteprocess._xpath_escape(string) == expected + + +@pytest.mark.parametrize('value', [ + 'foo', + 'foo"bar', # Make sure a " is preserved +]) +def test_set(quteproc, value): + quteproc.set_setting('network', 'accept-language', value) + read_back = quteproc.get_setting('network', 'accept-language') + assert read_back == value