diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2020-03-21 10:28:17 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-02-07 11:16:53 +0000 |
commit | 06cba6ccd165ca8b224797e37fccb9e63f026d77 (patch) | |
tree | e82f1bc439997ae296f2e74f8a64d84c5d95f140 /tests/cli_tests/test_command_input.py | |
parent | Initial commit. (diff) | |
download | iredis-06cba6ccd165ca8b224797e37fccb9e63f026d77.tar.xz iredis-06cba6ccd165ca8b224797e37fccb9e63f026d77.zip |
Adding upstream version 1.9.1.upstream/1.9.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/cli_tests/test_command_input.py')
-rw-r--r-- | tests/cli_tests/test_command_input.py | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/cli_tests/test_command_input.py b/tests/cli_tests/test_command_input.py new file mode 100644 index 0000000..4f970f5 --- /dev/null +++ b/tests/cli_tests/test_command_input.py @@ -0,0 +1,55 @@ +import pytest + + +def test_wrong_select_db_index(cli): + cli.sendline("select 1") + cli.expect(["OK", "127.0.0.1"]) + + cli.sendline("select 128") + cli.expect(["DB index is out of range", "127.0.0.1:6379[1]>"]) + + cli.sendline("select abc") + cli.expect(["invalid DB index", "127.0.0.1:6379[1]>"]) + + cli.sendline("select 15") + cli.expect("OK") + + +def test_set_command_with_shash(clean_redis, cli): + cli.sendline("set a \\hello\\") # legal redis command + cli.expect("OK") + + cli.sendline("get a") + cli.expect(r"hello") + + +def test_enter_key_binding(clean_redis, cli): + cli.send("set") + cli.expect("set") + cli.send("\033[B") # down + cli.sendline() # enter + + cli.sendline(" a 'hello'") + cli.expect("OK") + + cli.sendline("get a") + cli.expect(r"hello") + + +@pytest.mark.skipif("int(os.environ['REDIS_VERSION']) < 6") +def test_auth_hidden_password_with_username(clean_redis, cli): + cli.send("auth default hello-world") + cli.expect("default") + cli.expect(r"\*{11}") + + +@pytest.mark.skipif("int(os.environ['REDIS_VERSION']) > 5") +def test_auth_hidden_password(clean_redis, cli): + cli.send("auth hello-world") + cli.expect("auth") + cli.expect(r"\*{11}") + + +def test_hello_command_is_not_supported(cli): + cli.sendline("hello 3") + cli.expect("IRedis currently not support RESP3") |