示例#1
0
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,
        )
示例#2
0
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,
    )
示例#3
0
文件: expanded.py 项目: dbcli/pgcli
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)
示例#4
0
def step_tee_ouptut(context):
    context.tee_file_name = '../tee_file_{0}.sql'.format(context.conf['vi'])
    if os.path.exists(context.tee_file_name):
        os.remove(context.tee_file_name)
    context.cli.sendline('tee {0}'.format(
        os.path.basename(context.tee_file_name)))
    wrappers.expect_pager(context, "\r\n", timeout=5)
示例#5
0
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)
示例#6
0
def step_see_large_results(context):
    rows = ['{n:3}| {n}'.format(n=str(n)) for n in range(1, 50)]
    expected = ('***************************[ 1. row ]'
                '***************************\r\n' +
                '{}\r\n'.format('\r\n'.join(rows) + '\r\n'))

    wrappers.expect_pager(context, expected, timeout=5)
    wrappers.expect_exact(context, '1 row in set', timeout=2)
示例#7
0
def step_see_large_results(context):
    rows = ['{n:3}| {n}'.format(n=str(n)) for n in range(1, 50)]
    expected = ('***************************[ 1. row ]'
                '***************************\r\n' +
                '{}\r\n'.format('\r\n'.join(rows) + '\r\n'))

    wrappers.expect_pager(context, expected, timeout=10)
    wrappers.expect_exact(context, '1 row in set', timeout=2)
示例#8
0
def step_see_small_results(context):
    wrappers.expect_pager(context, dedent("""\
        +---+\r
        | 1 |\r
        +---+\r
        | 1 |\r
        +---+\r
        """), timeout=5)
    wrappers.expect_exact(context, '1 row in set', timeout=2)
示例#9
0
def step_see_small_results(context):
    wrappers.expect_pager(context, dedent("""\
        +------------+\r
        | ?column?   |\r
        |------------|\r
        | 1          |\r
        +------------+\r
        SELECT 1\r
        """), timeout=5)
示例#10
0
def step_prepare_data(context):
    """Create table, insert a record."""
    context.cli.sendline('drop table if exists a;')
    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)
示例#11
0
def step_prepare_data(context):
    """Create table, insert a record."""
    context.cli.sendline('drop table if exists a;')
    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)
示例#12
0
def step_query_select_123456(context):
    context.cli.sendline('select 123456')
    wrappers.expect_pager(context, dedent("""\
        +--------+\r
        | 123456 |\r
        +--------+\r
        | 123456 |\r
        +--------+\r
        1 row in set\r
        """), timeout=5)
示例#13
0
def step_query_select_123456(context):
    context.cli.sendline('select 123456')
    wrappers.expect_pager(context, dedent("""\
        +--------+\r
        | 123456 |\r
        +--------+\r
        | 123456 |\r
        +--------+\r
        """), timeout=5)
    wrappers.expect_exact(context, '1 row in set', timeout=2)
示例#14
0
def step_see_null_selected(context):
    """Wait to see null output."""
    wrappers.expect_pager(
        context, dedent("""\
            +--------+\r
            | NULL   |\r
            +--------+\r
            | <null> |\r
            +--------+\r
            """), timeout=1)
    wrappers.expect_exact(context, '1 row in set', timeout=2)
示例#15
0
def step_see_data_selected(context):
    """Wait to see select output."""
    wrappers.expect_pager(
        context, dedent("""\
            +-----+\r
            | x   |\r
            +-----+\r
            | yyy |\r
            +-----+\r
            """), timeout=2)
    wrappers.expect_exact(context, '1 row in set', timeout=2)
示例#16
0
def step_see_null_selected(context):
    """Wait to see null output."""
    wrappers.expect_pager(
        context, dedent("""\
            +--------+\r
            | NULL   |\r
            +--------+\r
            | <null> |\r
            +--------+\r
            """), timeout=2)
    wrappers.expect_exact(context, '1 row in set', timeout=2)
示例#17
0
def step_see_small_results(context):
    wrappers.expect_pager(context,
                          dedent("""\
        +---+\r
        | 1 |\r
        +---+\r
        | 1 |\r
        +---+\r
        """),
                          timeout=5)
    wrappers.expect_exact(context, '1 row in set', timeout=2)
示例#18
0
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)
示例#19
0
def step_see_data_selected(context):
    """Wait to see select output."""
    wrappers.expect_pager(
        context, dedent("""\
            +-----+\r
            | x   |\r
            +-----+\r
            | yyy |\r
            +-----+\r
            """), timeout=1)
    wrappers.expect_exact(context, '1 row in set', timeout=2)
示例#20
0
def step_query_select_number(context, param):
    context.cli.sendline(u'select {}'.format(param))
    wrappers.expect_pager(context, dedent(u"""\
        +{dashes}+\r
        | {param} |\r
        +{dashes}+\r
        | {param} |\r
        +{dashes}+\r
        \r
        """.format(param=param, dashes='-' * (len(param) + 2))
    ), timeout=5)
    wrappers.expect_exact(context, '1 row in set', timeout=2)
示例#21
0
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)
示例#22
0
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)
示例#23
0
文件: crud_table.py 项目: dbcli/pgcli
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)
示例#24
0
文件: crud_table.py 项目: dbcli/pgcli
def step_see_record_updated(context):
    """
    Wait to see update output.
    """
    wrappers.expect_pager(context, 'UPDATE 1\r\n', timeout=2)
示例#25
0
文件: crud_table.py 项目: dbcli/pgcli
def step_see_record_inserted(context):
    """
    Wait to see insert output.
    """
    wrappers.expect_pager(context, 'INSERT 0 1\r\n', timeout=2)
示例#26
0
def step_see_db_created(context):
    """
    Wait to see create database output.
    """
    wrappers.expect_pager(context, 'CREATE DATABASE\r\n', timeout=5)
示例#27
0
def step_see_db_created(context):
    """Wait to see create database output."""
    wrappers.expect_pager(context, 'Query OK, 1 row affected\r\n', timeout=2)
示例#28
0
def step_see_record_inserted(context):
    """
    Wait to see insert output.
    """
    wrappers.expect_pager(context, 'INSERT 0 1\r\n', timeout=2)
示例#29
0
def step_see_table_dropped(context):
    """
    Wait to see drop output.
    """
    wrappers.expect_pager(context, 'DROP TABLE\r\n', timeout=2)
示例#30
0
def step_see_named_query_saved(context):
    """
    Wait to see query saved.
    """
    wrappers.expect_pager(context, 'Saved.\r\n', timeout=1)
示例#31
0
def step_see_data_deleted(context):
    """Wait to see delete output."""
    wrappers.expect_pager(context, 'Query OK, 1 row affected\r\n', timeout=2)
示例#32
0
def step_see_record_updated(context):
    """Wait to see update output."""
    wrappers.expect_pager(context, 'Query OK, 1 row affected\r\n', timeout=2)
示例#33
0
def step_see_table_created(context):
    """Wait to see create table output."""
    wrappers.expect_pager(context, 'Query OK, 0 rows affected\r\n', timeout=2)
示例#34
0
def step_see_db_dropped(context):
    """
    Wait to see drop database output.
    """
    wrappers.expect_pager(context, "DROP DATABASE\r\n", timeout=2)
示例#35
0
文件: specials.py 项目: dbcli/pgcli
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)
示例#36
0
def step_see_named_query_deleted(context):
    """
    Wait to see query deleted.
    """
    wrappers.expect_pager(context, 'foo: Deleted\r\n', timeout=1)
示例#37
0
def step_see_data_deleted(context):
    """
    Wait to see delete output.
    """
    wrappers.expect_pager(context, 'DELETE 1\r\n', timeout=2)
示例#38
0
def step_see_db_created(context):
    """
    Wait to see create database output.
    """
    wrappers.expect_pager(context, "CREATE DATABASE\r\n", timeout=5)
示例#39
0
def step_see_table_created(context):
    """
    Wait to see create table output.
    """
    wrappers.expect_pager(context, 'CREATE TABLE\r\n', timeout=2)
示例#40
0
文件: crud_table.py 项目: dbcli/pgcli
def step_see_data_deleted(context):
    """
    Wait to see delete output.
    """
    wrappers.expect_pager(context, 'DELETE 1\r\n', timeout=2)
示例#41
0
def step_see_record_updated(context):
    """
    Wait to see update output.
    """
    wrappers.expect_pager(context, 'UPDATE 1\r\n', timeout=2)
示例#42
0
文件: crud_table.py 项目: dbcli/pgcli
def step_see_table_dropped(context):
    """
    Wait to see drop output.
    """
    wrappers.expect_pager(context, 'DROP TABLE\r\n', timeout=2)
示例#43
0
def step_see_db_dropped(context):
    """Wait to see drop database output."""
    wrappers.expect_pager(context, 'Query OK, 0 rows affected\r\n', timeout=2)
示例#44
0
文件: crud_table.py 项目: dbcli/pgcli
def step_see_table_created(context):
    """
    Wait to see create table output.
    """
    wrappers.expect_pager(context, 'CREATE TABLE\r\n', timeout=2)
示例#45
0
def step_notee_output(context):
    context.cli.sendline('notee')
    wrappers.expect_pager(context, "\r\n", timeout=5)
示例#46
0
def step_see_db_dropped(context):
    """
    Wait to see drop database output.
    """
    wrappers.expect_pager(context, 'DROP DATABASE\r\n', timeout=2)