summaryrefslogtreecommitdiffstats
path: root/tests/features/steps/wrappers.py
diff options
context:
space:
mode:
authorDick Marinus <dick@mrns.nl>2017-05-02 20:20:13 +0200
committerDick Marinus <dick@mrns.nl>2017-05-02 20:20:13 +0200
commitf39dda57731cdf9c054bfbfd0a326e67ec7e4a01 (patch)
tree3bac024263f25180377614bd9ccc3a370ede8651 /tests/features/steps/wrappers.py
parent81fb73f4b0343162f2ccc4d2d97893d4a0d2ee29 (diff)
Behave remove boiler plate code
Diffstat (limited to 'tests/features/steps/wrappers.py')
-rw-r--r--tests/features/steps/wrappers.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/features/steps/wrappers.py b/tests/features/steps/wrappers.py
index 5e3b22f1..8e960a81 100644
--- a/tests/features/steps/wrappers.py
+++ b/tests/features/steps/wrappers.py
@@ -2,6 +2,7 @@
from __future__ import unicode_literals
import re
+import pexpect
def expect_exact(context, expected, timeout):
@@ -18,3 +19,16 @@ def expect_exact(context, expected, timeout):
def expect_pager(context, expected, timeout):
expect_exact(context, "{0}\r\n{1}{0}\r\n".format(
context.conf['pager_boundary'], expected), timeout=timeout)
+
+
+def run_cli(context):
+ """Run the process using pexpect."""
+ cli_cmd = context.conf.get('cli_command')
+ context.cli = pexpect.spawnu(cli_cmd, cwd='..')
+ context.exit_sent = False
+ context.currentdb = context.conf['dbname']
+
+
+def wait_prompt(context):
+ """Make sure prompt is displayed."""
+ expect_exact(context, '{0}> '.format(context.conf['dbname']), timeout=5)