1
0
Fork 0

Merge pull request #279 from dbcli/j-bennet/itegration-tests

Moved integration tests into "tests", plus some fixes.
This commit is contained in:
Amjith Ramanujam 2015-07-14 23:16:52 -07:00
commit ae94c1640c
9 changed files with 11 additions and 6 deletions

View File

@ -144,6 +144,7 @@ After that, tests can be run with:
::
$ cd tests
$ behave
To see stdout/stderr, use the following command:

View File

@ -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)

View File

@ -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. |

View File

@ -14,8 +14,8 @@ Command
\e [file]
\l
\n[+] [name]
\nd [name [query]]
\ns [name [query]]
\nd [name]
\ns name query
\refresh
\timing
\x

View File

@ -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

View File

@ -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() + '!')