File: test_prompt_utils.py

package info (click to toggle)
pgcli 4.3.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,476 kB
  • sloc: python: 10,390; sh: 67; makefile: 8
file content (17 lines) | stat: -rw-r--r-- 523 bytes parent folder | download | duplicates (2)
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