summaryrefslogtreecommitdiffstats
path: root/tests/test_prompt_utils.py
blob: 91abe374a11ab54f7ecc5d5808e06fce61d5ecf2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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