Adding upstream version 1.9.1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
2bf0435a35
commit
031879240c
356 changed files with 26924 additions and 0 deletions
51
tests/cli_tests/test_warning.py
Normal file
51
tests/cli_tests/test_warning.py
Normal file
|
@ -0,0 +1,51 @@
|
|||
from iredis.warning import is_dangerous
|
||||
|
||||
|
||||
def test_is_dangerous():
|
||||
assert is_dangerous("KEYS") == (
|
||||
True,
|
||||
"KEYS will hang redis server, use SCAN instead",
|
||||
)
|
||||
|
||||
|
||||
def test_warning_for_dangerous_command(cli):
|
||||
cli.sendline("config set save '900 1'")
|
||||
cli.expect("Do you want to proceed?")
|
||||
cli.sendline("yes")
|
||||
|
||||
cli.sendline("config get save")
|
||||
cli.expect("900 1")
|
||||
|
||||
|
||||
def test_warnings_in_raw_mode(clean_redis, raw_cli):
|
||||
clean_redis.set("foo", "bar")
|
||||
raw_cli.sendline("keys *")
|
||||
raw_cli.expect("Do you want to proceed?")
|
||||
raw_cli.sendline("y")
|
||||
raw_cli.expect("foo")
|
||||
|
||||
|
||||
def test_warnings_in_raw_mode_canceled(clean_redis, raw_cli):
|
||||
clean_redis.set("foo", "bar")
|
||||
raw_cli.sendline("keys *")
|
||||
raw_cli.expect("Do you want to proceed?")
|
||||
raw_cli.sendline("n")
|
||||
# the f should never appeared
|
||||
raw_cli.expect("Canceled![^f]+127.0.0.1")
|
||||
|
||||
|
||||
def test_warnings_confirmed(clean_redis, cli):
|
||||
clean_redis.set("foo", "bar")
|
||||
cli.sendline("keys *")
|
||||
cli.expect("Do you want to proceed?")
|
||||
cli.sendline("y")
|
||||
cli.expect("foo")
|
||||
|
||||
|
||||
def test_warnings_canceled(clean_redis, cli):
|
||||
clean_redis.set("foo", "bar")
|
||||
cli.sendline("keys *")
|
||||
cli.expect("Do you want to proceed?")
|
||||
cli.sendline("n")
|
||||
# the f should never appeared
|
||||
cli.expect("Canceled![^f]+127.0.0.1")
|
Loading…
Add table
Add a link
Reference in a new issue