tests: Add quteproc.get_setting.

This commit is contained in:
Florian Bruhin 2015-11-23 13:30:49 +01:00
parent b7b4ee1b27
commit e6eaa5f140
2 changed files with 8 additions and 4 deletions

View File

@ -25,8 +25,5 @@ bdd.scenarios('set.feature')
@bdd.then(bdd.parsers.parse("{section} -> {option} should be {value}"))
def check_option(quteproc, section, option, value):
quteproc.send_cmd(':set {} {}?'.format(section, option))
msg = quteproc.wait_for(loglevel=logging.INFO, category='message',
message='{} {} = *'.format(section, option))
actual_value = msg.message.split(' = ')[1]
actual_value = quteproc.get_setting(section, option)
assert actual_value == value

View File

@ -204,6 +204,13 @@ class QuteProc(testprocess.Process):
self.wait_for(category='commands', module='command', function='run',
message='command called: *')
def get_setting(self, sect, opt):
"""Get the value of a qutebrowser setting."""
self.send_cmd(':set {} {}?'.format(sect, opt))
msg = self.wait_for(loglevel=logging.INFO, category='message',
message='{} {} = *'.format(sect, opt))
return msg.message.split(' = ')[1]
def set_setting(self, sect, opt, value):
self.send_cmd(':set "{}" "{}" "{}"'.format(sect, opt, value))
self.wait_for(category='config', message='Config option changed: *')