bdd: Add "I press the keys ..." step.

This commit is contained in:
Florian Bruhin 2015-11-25 17:19:16 +01:00
parent 7cfea665ff
commit 9fe02d55c9
2 changed files with 9 additions and 0 deletions

View File

@ -165,6 +165,11 @@ def wait_time(quteproc, delay):
time.sleep(float(delay))
@bdd.when(bdd.parsers.re('I press the keys? "(?P<keys>[^"]*)"'))
def press_keys(quteproc, keys):
quteproc.press_keys(keys)
@bdd.then(bdd.parsers.parse('"{pattern}" should not be logged'))
def ensure_not_logged(quteproc, pattern):
quteproc.ensure_not_logged(message=pattern)

View File

@ -281,6 +281,10 @@ class QuteProc(testprocess.Process):
with open(path, 'r', encoding='utf-8') as f:
return f.read()
def press_keys(self, keys):
"""Press the given keys using :fake-key."""
self.send_cmd(':fake-key -g "{}"'.format(keys))
@pytest.yield_fixture(scope='module')
def quteproc(qapp, httpbin, request):