summaryrefslogtreecommitdiffstats
path: root/tests/cli_tests/test_cli_pubsub.py
diff options
context:
space:
mode:
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")