Skip to content

Commit

Permalink
test for nested multi-bulk
Browse files Browse the repository at this point in the history
  • Loading branch information
fiorix committed Jul 13, 2012
1 parent 6e0f61d commit 7c7b340
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/test_multibulk.py
Expand Up @@ -73,3 +73,30 @@ def test_bulk_corner_cases(self):
yield self.db.set(self._KEY, x)
r = yield self.db.get(self._KEY)
self.assertEqual(r, x)


class NestedMultiBulk(unittest.TestCase):
@defer.inlineCallbacks
def testNestedMultiBulkTransaction(self):
db = yield redis.Connection(redis_host, redis_port, reconnect=False)

test1 = {u"foo1": u"bar1", u"something": u"else"}
test2 = {u"foo2": u"bar2", u"something": u"else"}

t = yield db.multi()
yield t.hmset("txredisapi:nmb:test1", test1)
yield t.hgetall("txredisapi:nmb:test1")
yield t.hmset("txredisapi:nmb:test2", test2)
yield t.hgetall("txredisapi:nmb:test2")
r = yield t.commit()

self.assertEqual(r[0], "OK")
self.assertEqual(sorted(r[1].keys()), sorted(test1.keys()))
self.assertEqual(sorted(r[1].values()), sorted(test1.values()))
self.assertEqual(r[2], "OK")
self.assertEqual(sorted(r[3].keys()), sorted(test2.keys()))
self.assertEqual(sorted(r[3].values()), sorted(test2.values()))

yield db.disconnect()


0 comments on commit 7c7b340

Please sign in to comment.