summaryrefslogtreecommitdiffstats
path: root/tests/cli_tests/test_cli_pubsub.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_cli_pubsub.py
parentInitial commit. (diff)
downloadiredis-upstream/1.13.0.tar.xz
iredis-upstream/1.13.0.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_cli_pubsub.py')
-rw-r--r--tests/cli_tests/test_cli_pubsub.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/cli_tests/test_cli_pubsub.py b/tests/cli_tests/test_cli_pubsub.py
new file mode 100644
index 0000000..956e105
--- /dev/null
+++ b/tests/cli_tests/test_cli_pubsub.py
@@ -0,0 +1,31 @@
+def test_subscribe(cli, clean_redis):
+ cli.sendline("subscribe foo")
+ cli.expect("subscribe from")
+ cli.expect("foo")
+ cli.expect("1")
+
+ clean_redis.publish("foo", "test message")
+ cli.expect("from")
+ cli.expect("foo")
+ cli.expect("test message")
+
+ # unsubscribe, send ctrl-c
+ cli.send(chr(3))
+ cli.expect("unsubscribe from")
+ cli.expect("0")
+
+
+def test_subscribe_in_raw_mode(raw_cli, clean_redis):
+ raw_cli.sendline("subscribe foo")
+ raw_cli.expect("subscribe\r")
+ raw_cli.expect("foo\r")
+ raw_cli.expect("1\r")
+
+ clean_redis.publish("foo", "test message")
+ raw_cli.expect("message\r")
+ raw_cli.expect("foo\r")
+ raw_cli.expect("test message")
+
+ # unsubscribe, send ctrl-c
+ raw_cli.send(chr(3))
+ raw_cli.expect("0\r")