summaryrefslogtreecommitdiffstats
path: root/tests/cli_tests/test_completer.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 17:38:04 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 17:38:04 +0000
commite0847dd62461001851da4c89f279e16b14c3eb4c (patch)
tree87422376dd9a7eee55850f0fce9a8bb4c13e44a2 /tests/cli_tests/test_completer.py
parentInitial commit. (diff)
downloadiredis-0ef2b3395587aa620326962d51fd004ccc21b0bd.tar.xz
iredis-0ef2b3395587aa620326962d51fd004ccc21b0bd.zip
Adding upstream version 1.13.0.upstream/1.13.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/cli_tests/test_completer.py')
-rw-r--r--tests/cli_tests/test_completer.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/cli_tests/test_completer.py b/tests/cli_tests/test_completer.py
new file mode 100644
index 0000000..4ffd058
--- /dev/null
+++ b/tests/cli_tests/test_completer.py
@@ -0,0 +1,51 @@
+import pytest
+
+
+def test_integer_type_completer(cli):
+ cli.expect("127.0.0.1")
+ cli.send("BITFIELD meykey GET ")
+ cli.expect(["i64", "u63", "u62"])
+ cli.sendline("u4 #0")
+ cli.expect("127.0.0.1")
+
+ cli.send("BITFIELD meykey GET ")
+ cli.expect(["u4", "i64", "u63", "u62"])
+
+
+def test_command_completion_when_a_command_is_another_command_substring(
+ cli, clean_redis
+):
+ cli.expect("127.0.0.1")
+ cli.send("set")
+ cli.expect(["set", "setnx", "setex", "setbit", "setrange"])
+
+ cli.send("n")
+ cli.expect("setnx")
+ cli.send("x")
+ cli.expect("setnx")
+ cli.sendline("foo bar")
+ cli.expect(["1", "127.0.0.1"])
+
+ cli.send("setnx")
+ cli.expect("foo")
+
+
+def test_command_completion_when_space_command(cli, clean_redis):
+ cli.expect("127.0.0.1")
+
+ cli.send("command in")
+ cli.expect("command info")
+
+
+@pytest.mark.skipif("int(os.environ['REDIS_VERSION']) < 6")
+def test_username_completer(cli, iredis_client):
+ iredis_client.execute("acl setuser", "foo1")
+ iredis_client.execute("acl setuser", "bar2")
+
+ cli.expect("127.0.0.1")
+ cli.sendline("acl users")
+ cli.expect("foo1")
+
+ cli.send("acl deluser ")
+ cli.expect("foo1")
+ cli.expect("bar2")