Skip to content

Commit

Permalink
+ReconnectTestCase
Browse files Browse the repository at this point in the history
  • Loading branch information
evilkost committed Apr 14, 2011
1 parent 57f8103 commit bbed682
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/server_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ def callback(result):
msg=source_line+' Got:'+repr(result))
return callback

def delayed(self, timeout, cb):
self.loop.add_timeout(time.time()+timeout, cb)

def finish(self, *args):
self.loop.stop()

Expand Down Expand Up @@ -713,5 +716,16 @@ def simulate(client, callbacks):
self.loop.add_callback(lambda: simulate(self.client, self.finish))
self.start()

class ReconnectTestCase(TornadoTestCase):
def test_run_stop_redis(self):
self.client.set('foo', 'bar', self.expect(True))
self.delayed(10, lambda:
self.client.get('foo', [
self.expect('bar'),
self.finish
])
)
self.start()

if __name__ == '__main__':
unittest.main()

0 comments on commit bbed682

Please sign in to comment.