mirror of https://github.com/dbcli/pgcli
behave test source command
This commit is contained in:
parent
7eef21e3d3
commit
8fa3d18353
|
@ -18,6 +18,7 @@ Internal changes:
|
|||
* Run pep8 checks in travis (Thanks: `Irina Truong`_).
|
||||
* Add pager wrapper for behave tests (Thanks: `Dick Marinus`_).
|
||||
* Behave quit pgcli nicely (Thanks: `Dick Marinus`_).
|
||||
* Behave test source command (Thanks: `Dick Marinus`_).
|
||||
|
||||
1.5.1
|
||||
=====
|
||||
|
|
|
@ -12,6 +12,12 @@ Feature: run the cli,
|
|||
and we send "\?" command
|
||||
then we see help output
|
||||
|
||||
Scenario: run source command
|
||||
When we run dbcli
|
||||
and we wait for prompt
|
||||
and we send source command
|
||||
then we see help output
|
||||
|
||||
Scenario: run the cli and exit
|
||||
When we run dbcli
|
||||
and we wait for prompt
|
||||
|
|
|
@ -7,6 +7,7 @@ This string is used to call the step in "*.feature" file.
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import pexpect
|
||||
import tempfile
|
||||
|
||||
from behave import when
|
||||
import wrappers
|
||||
|
@ -19,6 +20,7 @@ def step_run_cli(context):
|
|||
"""
|
||||
cli_cmd = context.conf.get('cli_command')
|
||||
context.cli = pexpect.spawnu(cli_cmd, cwd='..')
|
||||
context.cli.logfile = open('/tmp/dmtest', 'a')
|
||||
context.exit_sent = False
|
||||
context.currentdb = context.conf['dbname']
|
||||
|
||||
|
@ -46,3 +48,13 @@ def step_send_help(context):
|
|||
Send \? to see help.
|
||||
"""
|
||||
context.cli.sendline('\?')
|
||||
|
||||
|
||||
@when(u'we send source command')
|
||||
def step_send_source_command(context):
|
||||
with tempfile.NamedTemporaryFile() as f:
|
||||
f.write(b'\?')
|
||||
f.flush()
|
||||
context.cli.sendline('\i {0}'.format(f.name))
|
||||
wrappers.expect_exact(
|
||||
context, context.conf['pager_boundary'] + '\r\n', timeout=5)
|
||||
|
|
Loading…
Reference in New Issue