bdd: Make quteproc.set_setting work with quotes
This hopefully fixes editor BDD tests on Windows as the editor path is now correctly quoted.
This commit is contained in:
parent
14eb63d9e9
commit
d02d99e53e
@ -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: *')
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user