From 56bdb74ed97a787e61d08fa50ca8833f81ac0621 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 9 Nov 2015 07:37:04 +0100 Subject: [PATCH] bdd: Allow (port) replacement in "When I run ...". --- tests/integration/features/conftest.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/integration/features/conftest.py b/tests/integration/features/conftest.py index a2630417e..08c1e56b7 100644 --- a/tests/integration/features/conftest.py +++ b/tests/integration/features/conftest.py @@ -43,13 +43,19 @@ def open_path_when(quteproc, path): quteproc.open_path(path) +@bdd.when(bdd.parsers.parse("I set {sect} -> {opt} to {value}")) +def set_setting_when(quteproc, sect, opt, value): + quteproc.set_setting(sect, opt, value) + + @bdd.given(bdd.parsers.parse("I run {command}")) def run_command_given(quteproc, command): quteproc.send_cmd(command) @bdd.when(bdd.parsers.parse("I run {command}")) -def run_command_when(quteproc, command): +def run_command_when(quteproc, httpbin, command): + command = command.replace('(port)', str(httpbin.port)) quteproc.send_cmd(command)