summaryrefslogtreecommitdiffstats
path: root/tests/features/steps/crud_database.py
blob: 3fd8b7a10469440075680a7510b9f748e178bd62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
"""
Steps for behavioral style tests are defined in this module.
Each step is defined by the string decorating it.
This string is used to call the step in "*.feature" file.
"""
import pexpect

from behave import when, then
import wrappers


@when("we create database")
def step_db_create(context):
    """
    Send create database.
    """
    context.cli.sendline("create database {0};".format(context.conf["dbname_tmp"]))

    context.response = {"database_name": context.conf["dbname_tmp"]}


@when("we drop database")
def step_db_drop(context):
    """
    Send drop database.
    """
    context.cli.sendline("drop database {0};".format(context.conf["dbname_tmp"]))


@when("we connect to test database")
def step_db_connect_test(context):
    """
    Send connect to database.
    """
    db_name = context.conf["dbname"]
    context.cli.sendline("\\connect {0}".format(db_name))


@when("we connect to dbserver")
def step_db_connect_dbserver(context):
    """
    Send connect to database.
    """
    context.cli.sendline("\\connect postgres")
    context.currentdb = "postgres"


@then("dbcli exits")
def step_wait_exit(context):
    """
    Make sure the cli exits.
    """
    wrappers.expect_exact(context, pexpect.EOF, timeout=5)


@then("we see dbcli prompt")
def step_see_prompt(context):
    """
    Wait to see the prompt.
    """
    db_name = getattr(context, "currentdb", context.conf["dbname"])
    wrappers.expect_exact(context, "{0}> ".format(db_name), timeout=5)
    context.atprompt = True


@then("we see help output")
def step_see_help(context):
    for expected_line in context.fixture_data["help_commands.txt"]:
        wrappers.expect_exact(context, expected_line, timeout=2)


@then("we see database created")
def step_see_db_created(context):
    """
    Wait to see create database output.
    """
    wrappers.expect_pager(context, "CREATE DATABASE\r\n", timeout=5)


@then("we see database dropped")
def step_see_db_dropped(context):
    """
    Wait to see drop database output.
    """
    wrappers.expect_pager(context, "DROP DATABASE\r\n", timeout=2)


@then("we see database connected")
def step_see_db_connected(context):
    """
    Wait to see drop database output.
    """
    wrappers.expect_exact(context, "You are now connected to database", timeout=2)
xxd Verwissel\ na\ HEX<Tab>:%!xxd menutrans Convert\ back<Tab>:%!xxd\ -r Verwissel\ terug<Tab>:%!xxd\ -r " Names for buffer menu. menutrans &Buffers &Buffers menutrans Refresh Verfris menutrans Delete Verwyder menutrans Alternate Vorige menutrans [No\ File] [Geen\ Le�r] " Window menu menutrans &Window &Venster menutrans &New<Tab>^Wn &Nuut<Tab>^Wn menutrans S&plit<Tab>^Ws Ver&deel<Tab>^Ws menutrans Sp&lit\ To\ #<Tab>^W^^ Verdeel\ N&a\ #<Tab>^W^^ menutrans Split\ &Vertically<Tab>^Wv Verdeel\ Vertikaal<Tab>^Wv menutrans &Close<Tab>^Wc &Maak\ toe<Tab>^Wc menutrans Close\ &Other(s)<Tab>^Wo Maak\ &Ander\ Toe<Tab>^Wo menutrans Ne&xt<Tab>^Ww Volgende<Tab>^Ww menutrans P&revious<Tab>^WW &Vorige<Tab>^WW menutrans &Equal\ Size<Tab>^W= &Gelyke\ hoogte<Tab>^W= menutrans &Max\ Height<Tab>^W_ &Maksimale\ hoogte<Tab>^W_ menutrans M&in\ Height<Tab>^W1_ Mi&nimale\ hoogte<Tab>^W1_ menutrans Max\ Width<Tab>^W\| Maksimale\ breedte<Tab>^W\| menutrans Min\ Width<Tab>^W1\| Minimale\ breedte<Tab>^W1\| menutrans Rotate\ &Up<Tab>^WR Roteer\ na\ &bo<Tab>^WR menutrans Rotate\ &Down<Tab>^Wr Roteer\ na\ &onder<Tab>^Wr menutrans Select\ Fo&nt\.\.\. Kies\ font\.\.\. " The popup menu menutrans &Undo &Terug menutrans Cu&t Knip menutrans &Copy &Kopi�er menutrans &Paste &Plak menutrans &Delete &Verwyder menutrans Select\ Blockwise Kies\ per\ Blok menutrans Select\ &Word Kies\ een\ &Woord menutrans Select\ &Line Kies\ een\ &Re�l menutrans Select\ &Block Kies\ een\ &Blok menutrans Select\ &All Kies\ &Alles " The GUI toolbar if has("toolbar") if exists("*Do_toolbar_tmenu") delfun Do_toolbar_tmenu endif fun Do_toolbar_tmenu() tmenu ToolBar.Open Maak ler oop tmenu ToolBar.Save Skryf ler tmenu ToolBar.SaveAll Skryf alle lers tmenu ToolBar.Print Druk tmenu ToolBar.Undo Terug tmenu ToolBar.Redo Vooruit tmenu ToolBar.Cut Knip tmenu ToolBar.Copy Kopi�er tmenu ToolBar.Paste Plak tmenu ToolBar.Find Soek... tmenu ToolBar.FindNext Soek volgende tmenu ToolBar.FindPrev Soek vorige tmenu ToolBar.Replace Soek en vervang... tmenu ToolBar.LoadSesn Laai sessie tmenu ToolBar.SaveSesn Stoor sessie tmenu ToolBar.RunScript Voer vim skrip uit tmenu ToolBar.Make Voer make uit tmenu ToolBar.Shell Begin dop tmenu ToolBar.RunCtags Genereer etikette tmenu ToolBar.TagJump Spring na etiket tmenu ToolBar.Help Hulp tmenu ToolBar.FindHelp Soek hulp... endfun endif " Syntax menu menutrans &Syntax &Sintaks menutrans Set\ 'syntax'\ only Stel\ slegs\ 'syntax' menutrans Set\ 'filetype'\ too Verander\ 'filetype'\ ook menutrans &Off &Af menutrans &Manual &Met\ die\ hand menutrans A&utomatic O&utomaties menutrans o&n\ (this\ file) Aa&n\ (die\ ler) menutrans o&ff\ (this\ file) &Af\ (die\ ler) menutrans Co&lor\ test Toets\ die\ &kleure menutrans &Highlight\ test Toets\ die\ verligting menutrans &Convert\ to\ HTML Verwissel\ na\ HTML let &cpo = s:keepcpo unlet s:keepcpo