Skip to content

Commit

Permalink
[unittest] very basic test for psubscribe
Browse files Browse the repository at this point in the history
  • Loading branch information
evilkost committed May 19, 2011
1 parent 85c67d9 commit 7956020
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/server_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,26 @@ def on_subscription(msg):
)
self.start()

def test_pub_psub(self):
def on_recv(msg):
self.assert_pubsub(msg, 'pmessage', 'foo.*', 'bar')

def on_subscription(msg):
self.assert_pubsub(msg, 'psubscribe', 'foo.*', 1)
self.client2.listen(on_recv)

self.client2.psubscribe('foo.*', on_subscription)
self.delayed(0.1, lambda:
self.client2.set('gtx', 'rd', self.expect(RequestError)))
self.delayed(0.3, lambda:
self.client.publish('foo.1', 'bar')
)
self.delayed(0.3, lambda:
self.client.publish('bar.1', 'zar',
lambda *args: self.delayed(0.4, self.finish))
)
self.start()

def test_unsubscribe(self):
global c
c = 0
Expand Down

0 comments on commit 7956020

Please sign in to comment.