Skip to content

Commit

Permalink
added AsyncWrapperTestCase
Browse files Browse the repository at this point in the history
  • Loading branch information
evilkost committed Apr 13, 2011
1 parent 774cd8c commit 72a1e96
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion run_nose.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env sh
PYTHONPATH=../facebook-tornado/:. nosetests -w tests $1 --with-coverage --cover-package=brukva --nologcapture --nocapture
PYTHONPATH=../facebook-tornado/:. nosetests -w tests $1 --with-coverage --cover-package=brukva --nologcapture --nocapture -v

15 changes: 15 additions & 0 deletions tests/server_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from tornado.ioloop import IOLoop

import brukva
from brukva.adisp import process, async
from brukva.exceptions import ResponseError

def callable(obj):
Expand Down Expand Up @@ -692,6 +693,20 @@ def on_subscription(msg):
)
self.start()

class AsyncWrapperTestCase(TornadoTestCase):
def test_wrapper(self):
@process
def simulate(client, callbacks):
res = yield client.async.set('foo1', 'bar')
self.assertEquals(res, True)
res = yield client.async.set('foo2', 'zar')
self.assertEquals(res, True)
r1, r2 = yield [client.async.get('foo1'), client.async.get('foo2')]
self.assertEquals(r1, 'bar')
self.assertEquals(r2, 'zar')
callbacks(None)
self.loop.add_callback(lambda: simulate(self.client, self.finish))
self.start()

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

0 comments on commit 72a1e96

Please sign in to comment.