summaryrefslogtreecommitdiff
path: root/tests/test_pubsub.py
diff options
context:
space:
mode:
authorKrishan Patel <krishan.patel@carbonnv.com>2018-08-13 20:08:35 +0100
committerKrishan Patel <krishan.patel@carbonnv.com>2018-08-13 20:08:35 +0100
commitca600053a333a2962d8d15cfb7b92eddbc5123bf (patch)
tree77292c3a52239d53105db2f120288aad9f486b41 /tests/test_pubsub.py
parentf95b27ee1b74952317280f751c59c0ff32d2ffea (diff)
downloadredis-py-ca600053a333a2962d8d15cfb7b92eddbc5123bf.tar.gz
Added test
Diffstat (limited to 'tests/test_pubsub.py')
-rw-r--r--tests/test_pubsub.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/test_pubsub.py b/tests/test_pubsub.py
index a240248..68a1729 100644
--- a/tests/test_pubsub.py
+++ b/tests/test_pubsub.py
@@ -27,7 +27,7 @@ def make_message(type, channel, data, pattern=None):
return {
'type': type,
'pattern': pattern and pattern.encode('utf-8') or None,
- 'channel': channel.encode('utf-8'),
+ 'channel': channel and channel.encode('utf-8') or None,
'data': data.encode('utf-8') if isinstance(data, basestring) else data
}
@@ -427,3 +427,15 @@ class TestPubSubPubSubSubcommands(object):
p = r.pubsub(ignore_subscribe_messages=True)
p.psubscribe('*oo', '*ar', 'b*z')
assert r.pubsub_numpat() == 3
+
+
+class TestPubSubPings(object):
+
+ @skip_if_server_version_lt('3.0.0')
+ def test_send_pubsub_ping(self, r):
+ p = r.pubsub(ignore_subscribe_messages=True)
+ p.subscribe('foo')
+ p.ping()
+ assert wait_for_message(p) == make_message(type='pong', channel=None,
+ data='',
+ pattern=None)