From 708c091a8b4db6a55be1c96ae33ee0da632b269f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 05:06:41 +0200 Subject: Adding upstream version 4.0.1. Signed-off-by: Daniel Baumann --- tests/test_prompt_utils.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/test_prompt_utils.py (limited to 'tests/test_prompt_utils.py') diff --git a/tests/test_prompt_utils.py b/tests/test_prompt_utils.py new file mode 100644 index 0000000..91abe37 --- /dev/null +++ b/tests/test_prompt_utils.py @@ -0,0 +1,17 @@ +import click + +from pgcli.packages.prompt_utils import confirm_destructive_query + + +def test_confirm_destructive_query_notty(): + stdin = click.get_text_stream("stdin") + if not stdin.isatty(): + sql = "drop database foo;" + assert confirm_destructive_query(sql, [], None) is None + + +def test_confirm_destructive_query_with_alias(): + stdin = click.get_text_stream("stdin") + if not stdin.isatty(): + sql = "drop database foo;" + assert confirm_destructive_query(sql, ["drop"], "test") is None -- cgit v1.2.3