| 1 |
def test_subscribe(cli, clean_redis): |
| 2 |
cli.sendline("subscribe foo") |
| 3 |
cli.expect("subscribe from") |
| 4 |
cli.expect("foo") |
| 5 |
cli.expect("1") |
| 6 |
|
| 7 |
clean_redis.publish("foo", "test message") |
| 8 |
cli.expect("from") |
| 9 |
cli.expect("foo") |
| 10 |
cli.expect("test message") |
| 11 |
|
| 12 |
# unsubscribe, send ctrl-c |
| 13 |
cli.send(chr(3)) |
| 14 |
cli.expect("unsubscribe from") |
| 15 |
cli.expect("0") |
| 16 |
|
| 17 |
|
| 18 |
def test_subscribe_in_raw_mode(raw_cli, clean_redis): |
| 19 |
raw_cli.sendline("subscribe foo") |
| 20 |
raw_cli.expect("subscribe\r") |
| 21 |
raw_cli.expect("foo\r") |
| 22 |
raw_cli.expect("1\r") |
| 23 |
|
| 24 |
clean_redis.publish("foo", "test message") |
| 25 |
raw_cli.expect("message\r") |
| 26 |
raw_cli.expect("foo\r") |
| 27 |
raw_cli.expect("test message") |
| 28 |
|
| 29 |
# unsubscribe, send ctrl-c |
| 30 |
raw_cli.send(chr(3)) |
| 31 |
raw_cli.expect("0\r") |