| 1 |
def test_publish(judge_command): |
| 2 |
judge_command( |
| 3 |
"publish foo bar", {"command": "publish", "channel": "foo", "message": "bar"} |
| 4 |
) |
| 5 |
|
| 6 |
|
| 7 |
def test_subscribe(judge_command): |
| 8 |
judge_command("subscribe foo bar", {"command": "subscribe", "channel": "bar"}) |
| 9 |
|
| 10 |
|
| 11 |
def test_pubsub(judge_command): |
| 12 |
"""PUBSUB CHANNELS/NUMSUB/NUMPAT accept 0 or more channels (per commands.json).""" |
| 13 |
judge_command( |
| 14 |
"PUBSUB CHANNELS", |
| 15 |
{"command": "PUBSUB CHANNELS"}, |
| 16 |
) |
| 17 |
judge_command( |
| 18 |
"PUBSUB NUMSUB", |
| 19 |
{"command": "PUBSUB NUMSUB"}, |
| 20 |
) |
| 21 |
judge_command( |
| 22 |
"PUBSUB NUMSUB foo bar", |
| 23 |
{"command": "PUBSUB NUMSUB", "parameters": "foo bar"}, |
| 24 |
) |
| 25 |
judge_command( |
| 26 |
"PUBSUB CHANNELS mypattern", |
| 27 |
{"command": "PUBSUB CHANNELS", "parameters": "mypattern"}, |
| 28 |
) |
| 29 |
|
| 30 |
|
| 31 |
def test_punsubscribe(judge_command): |
| 32 |
"""PUNSUBSCRIBE accepts 0 or more patterns (per commands.json).""" |
| 33 |
judge_command("PUNSUBSCRIBE", {"command": "PUNSUBSCRIBE"}) |
| 34 |
judge_command( |
| 35 |
"PUNSUBSCRIBE p1 p2", |
| 36 |
{"command": "PUNSUBSCRIBE", "channel": "p2"}, |
| 37 |
) |
| 38 |
|
| 39 |
|
| 40 |
def test_unsubscribe(judge_command): |
| 41 |
"""UNSUBSCRIBE accepts 0 or more channels (per commands.json).""" |
| 42 |
judge_command("UNSUBSCRIBE", {"command": "UNSUBSCRIBE"}) |
| 43 |
judge_command( |
| 44 |
"UNSUBSCRIBE c1 c2", |
| 45 |
{"command": "UNSUBSCRIBE", "channel": "c2"}, |
| 46 |
) |