def step_see_data(context, which): """Select data from expanded test table.""" if which == 'expanded': wrappers.expect_pager( context, dedent('''\ -[ RECORD 1 ]-------------------------\r x | 1\r y | 1.0\r z | 1.0000\r SELECT 1\r '''), timeout=1) else: wrappers.expect_pager( context, dedent('''\ +-----+-----+--------+\r | x | y | z |\r |-----+-----+--------|\r | 1 | 1.0 | 1.0000 |\r +-----+-----+--------+\r SELECT 1\r '''), timeout=1)
def step_see_refresh_started(context): """ Wait to see refresh output. """ wrappers.expect_pager( context, 'Auto-completion refresh started in the background.\r\n', timeout=2)
def step_see_large_results(context): wrappers.expect_pager(context, dedent("""\ -[ RECORD 1 ]-------------------------\r ?column? | 1\r ?column? | 2\r ?column? | 3\r ?column? | 4\r ?column? | 5\r ?column? | 6\r ?column? | 7\r ?column? | 8\r ?column? | 9\r ?column? | 10\r ?column? | 11\r ?column? | 12\r ?column? | 13\r ?column? | 14\r ?column? | 15\r ?column? | 16\r ?column? | 17\r ?column? | 18\r ?column? | 19\r ?column? | 20\r ?column? | 21\r ?column? | 22\r ?column? | 23\r ?column? | 24\r ?column? | 25\r ?column? | 26\r ?column? | 27\r ?column? | 28\r ?column? | 29\r ?column? | 30\r ?column? | 31\r ?column? | 32\r ?column? | 33\r ?column? | 34\r ?column? | 35\r ?column? | 36\r ?column? | 37\r ?column? | 38\r ?column? | 39\r ?column? | 40\r ?column? | 41\r ?column? | 42\r ?column? | 43\r ?column? | 44\r ?column? | 45\r ?column? | 46\r ?column? | 47\r ?column? | 48\r ?column? | 49\r SELECT 1\r """), timeout=5)
def step_see_small_results(context): wrappers.expect_pager(context, dedent("""\ +------------+\r | ?column? |\r |------------|\r | 1 |\r +------------+\r SELECT 1\r """), timeout=5)
def step_prepare_data(context): """Create table, insert a record.""" context.cli.sendline('drop table if exists a;') wrappers.expect_exact( context, 'You\'re about to run a destructive command.\r\nDo you want to proceed? (y/n):', timeout=2) context.cli.sendline('y') wrappers.wait_prompt(context) context.cli.sendline( 'create table a(x integer, y real, z numeric(10, 4));') wrappers.expect_pager(context, 'CREATE TABLE\r\n', timeout=2) context.cli.sendline('''insert into a(x, y, z) values(1, 1.0, 1.0);''') wrappers.expect_pager(context, 'INSERT 0 1\r\n', timeout=2)
def step_see_data_selected(context): """ Wait to see select output. """ wrappers.expect_pager(context, dedent('''\ +-----+\r | x |\r |-----|\r | yyy |\r +-----+\r SELECT 1\r '''), timeout=1)
def step_see_db_dropped(context): """ Wait to see drop database output. """ wrappers.expect_pager(context, 'DROP DATABASE\r\n', timeout=2)
def step_see_db_created(context): """ Wait to see create database output. """ wrappers.expect_pager(context, 'CREATE DATABASE\r\n', timeout=5)
def step_see_named_query_deleted(context): """ Wait to see query deleted. """ wrappers.expect_pager(context, 'foo: Deleted\r\n', timeout=1)
def step_see_named_query_saved(context): """ Wait to see query saved. """ wrappers.expect_pager(context, 'Saved.\r\n', timeout=1)
def step_see_record_updated(context): """ Wait to see update output. """ wrappers.expect_pager(context, 'UPDATE 1\r\n', timeout=2)
def step_see_record_inserted(context): """ Wait to see insert output. """ wrappers.expect_pager(context, 'INSERT 0 1\r\n', timeout=2)
def step_see_table_created(context): """ Wait to see create table output. """ wrappers.expect_pager(context, 'CREATE TABLE\r\n', timeout=2)
def step_see_table_dropped(context): """ Wait to see drop output. """ wrappers.expect_pager(context, 'DROP TABLE\r\n', timeout=2)
def step_see_data_deleted(context): """ Wait to see delete output. """ wrappers.expect_pager(context, 'DELETE 1\r\n', timeout=2)