File: test_cli_pubsub.py

package info (click to toggle)
iredis 1.15.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,244 kB
  • sloc: python: 7,196; sh: 16; makefile: 14
file content (31 lines) | stat: -rw-r--r-- 787 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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")