diff options
author | Dick Marinus <dick@mrns.nl> | 2018-05-26 15:49:41 +0200 |
---|---|---|
committer | Dick Marinus <dick@mrns.nl> | 2018-05-26 15:49:41 +0200 |
commit | 95fda8218b8ed5130028071d8cdd7a489fae376a (patch) | |
tree | 0fce4360cc8677cf530a803cbde5225eec5719c7 /tests | |
parent | a274c731fcd6482099d77c9ed4ca26995ebb67d1 (diff) |
Refactor destructive warning in behave tests
Diffstat (limited to 'tests')
-rw-r--r-- | tests/features/crud_database.feature | 1 | ||||
-rw-r--r-- | tests/features/crud_table.feature | 2 | ||||
-rw-r--r-- | tests/features/expanded.feature | 3 | ||||
-rw-r--r-- | tests/features/steps/basic_commands.py | 8 | ||||
-rw-r--r-- | tests/features/steps/crud_database.py | 3 | ||||
-rw-r--r-- | tests/features/steps/crud_table.py | 6 |
6 files changed, 14 insertions, 9 deletions
diff --git a/tests/features/crud_database.feature b/tests/features/crud_database.feature index 32d1e38d..ed13bbe0 100644 --- a/tests/features/crud_database.feature +++ b/tests/features/crud_database.feature @@ -5,6 +5,7 @@ Feature: manipulate databases: When we create database then we see database created when we drop database + then we confirm the destructive warning then we see database dropped when we connect to dbserver then we see database connected diff --git a/tests/features/crud_table.feature b/tests/features/crud_table.feature index bcef9292..1f9db4a0 100644 --- a/tests/features/crud_table.feature +++ b/tests/features/crud_table.feature @@ -13,8 +13,10 @@ Feature: manipulate tables: when we select from table then we see data selected when we delete from table + then we confirm the destructive warning then we see record deleted when we drop table + then we confirm the destructive warning then we see table dropped when we connect to dbserver then we see database connected diff --git a/tests/features/expanded.feature b/tests/features/expanded.feature index e92f1d00..4f381f81 100644 --- a/tests/features/expanded.feature +++ b/tests/features/expanded.feature @@ -7,6 +7,7 @@ Feature: expanded mode: and we select from table then we see expanded data selected when we drop table + then we confirm the destructive warning then we see table dropped Scenario: expanded off @@ -15,6 +16,7 @@ Feature: expanded mode: and we select from table then we see nonexpanded data selected when we drop table + then we confirm the destructive warning then we see table dropped Scenario: expanded auto @@ -23,4 +25,5 @@ Feature: expanded mode: and we select from table then we see auto data selected when we drop table + then we confirm the destructive warning then we see table dropped diff --git a/tests/features/steps/basic_commands.py b/tests/features/steps/basic_commands.py index d8d603e2..83e05831 100644 --- a/tests/features/steps/basic_commands.py +++ b/tests/features/steps/basic_commands.py @@ -71,3 +71,11 @@ def step_see_found(context): ''') + context.conf['pager_boundary'], timeout=5 ) + + +@then(u'we confirm the destructive warning') +def step_confirm_destructive_command(context): + """Confirm destructive command.""" + 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') diff --git a/tests/features/steps/crud_database.py b/tests/features/steps/crud_database.py index 4a1a9d14..f049ee7e 100644 --- a/tests/features/steps/crud_database.py +++ b/tests/features/steps/crud_database.py @@ -32,9 +32,6 @@ 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 55c31da7..360f78f9 100644 --- a/tests/features/steps/crud_table.py +++ b/tests/features/steps/crud_table.py @@ -49,9 +49,6 @@ 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') @@ -60,9 +57,6 @@ 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') |