summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAmjith Ramanujam <amjith.r@gmail.com>2018-05-18 21:24:43 -0700
committerAmjith Ramanujam <amjith.r@gmail.com>2018-05-18 21:28:13 -0700
commit3c26ddf4c3273a06db85ada4ea06cb3952ca89a6 (patch)
treed73f51bf762e45cc29bdeca95b31b56880378e02 /tests
parent0643fd65346ba6fa5620f5d15d2554a8ce019027 (diff)
Add confirmation prompt to destructive commands in behave tests.
Diffstat (limited to 'tests')
-rw-r--r--tests/features/steps/crud_database.py3
-rw-r--r--tests/features/steps/crud_table.py6
-rw-r--r--tests/features/steps/expanded.py4
3 files changed, 13 insertions, 0 deletions
diff --git a/tests/features/steps/crud_database.py b/tests/features/steps/crud_database.py
index f049ee7e..4a1a9d14 100644
--- a/tests/features/steps/crud_database.py
+++ b/tests/features/steps/crud_database.py
@@ -32,6 +32,9 @@ def step_db_drop(context):
"""
context.cli.sendline('drop database {0};'.format(
context.conf['dbname_tmp']))
+ 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')
@when('we connect to test database')
diff --git a/tests/features/steps/crud_table.py b/tests/features/steps/crud_table.py
index 360f78f9..55c31da7 100644
--- a/tests/features/steps/crud_table.py
+++ b/tests/features/steps/crud_table.py
@@ -49,6 +49,9 @@ def step_delete_from_table(context):
Send deete from table.
"""
context.cli.sendline('''delete from a where x = 'yyy';''')
+ 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')
@when('we drop table')
@@ -57,6 +60,9 @@ def step_drop_table(context):
Send drop table.
"""
context.cli.sendline('drop table 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')
@then('we see table created')
diff --git a/tests/features/steps/expanded.py b/tests/features/steps/expanded.py
index 5360ea22..b1970a34 100644
--- a/tests/features/steps/expanded.py
+++ b/tests/features/steps/expanded.py
@@ -16,6 +16,10 @@ from textwrap import dedent
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));')