mirror of https://github.com/dbcli/pgcli
Moved behavioral tests into tests. Updated expected help output. Drop test db if exists.
This commit is contained in:
parent
7c0f1a1284
commit
4980b4ef09
|
@ -144,6 +144,7 @@ After that, tests can be run with:
|
|||
|
||||
::
|
||||
|
||||
$ cd tests
|
||||
$ behave
|
||||
|
||||
To see stdout/stderr, use the following command:
|
||||
|
|
|
@ -23,6 +23,7 @@ def create_db(hostname='localhost', username=None, password=None,
|
|||
cn.set_isolation_level(0)
|
||||
|
||||
with cn.cursor() as cr:
|
||||
cr.execute('drop database if exists %s', (AsIs(dbname),))
|
||||
cr.execute('create database %s', (AsIs(dbname),))
|
||||
|
||||
cn.close()
|
||||
|
@ -66,7 +67,7 @@ def drop_db(hostname='localhost', username=None, password=None,
|
|||
cn.set_isolation_level(0)
|
||||
|
||||
with cn.cursor() as cr:
|
||||
cr.execute('drop database %s', (AsIs(dbname),))
|
||||
cr.execute('drop database if exists %s', (AsIs(dbname),))
|
||||
|
||||
close_cn(cn)
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
| \l | List databases. |
|
||||
| \n[+] [name] | List or execute named queries. |
|
||||
| \nd [name [query]] | Delete a named query. |
|
||||
| \ns [name [query]] | Save a named query. |
|
||||
| \ns name query | Save a named query. |
|
||||
| \refresh | Refresh auto-completions. |
|
||||
| \timing | Toggle timing of commands. |
|
||||
| \x | Toggle expanded output. |
|
|
@ -14,8 +14,8 @@ Command
|
|||
\e [file]
|
||||
\l
|
||||
\n[+] [name]
|
||||
\nd [name [query]]
|
||||
\ns [name [query]]
|
||||
\nd [name]
|
||||
\ns name query
|
||||
\refresh
|
||||
\timing
|
||||
\x
|
|
@ -13,7 +13,7 @@ def read_fixture_lines(filename):
|
|||
:return: list of strings
|
||||
"""
|
||||
lines = []
|
||||
for line in codecs.open(filename, 'r', encoding='utf-8'):
|
||||
for line in codecs.open(filename, 'rb', encoding='utf-8'):
|
||||
lines.append(line.strip())
|
||||
return lines
|
||||
|
|
@ -73,4 +73,7 @@ def step_see_prompt(context):
|
|||
@then('we see help output')
|
||||
def step_see_help(context):
|
||||
for expected_line in context.fixture_data['help_commands.txt']:
|
||||
context.cli.expect_exact(expected_line)
|
||||
try:
|
||||
context.cli.expect_exact(expected_line, timeout=1)
|
||||
except Exception:
|
||||
raise Exception('Expected: ' + expected_line.strip() + '!')
|
Loading…
Reference in New Issue