diff options
author | Rafael H. Schloming <rhs@apache.org> | 2009-08-20 23:03:28 +0000 |
---|---|---|
committer | Rafael H. Schloming <rhs@apache.org> | 2009-08-20 23:03:28 +0000 |
commit | f34769235c625d5afe031076b6738f6ae672c3ff (patch) | |
tree | f680c97f82a5dfa17150640c52c6356625e2a214 /python/qpid/tests/messaging.py | |
parent | a55a45cac6111b666de84823686bf6405483099e (diff) | |
download | qpid-python-f34769235c625d5afe031076b6738f6ae672c3ff.tar.gz |
implemented reconnect and separated out the protocol driver from the messaging client
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@806393 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/qpid/tests/messaging.py')
-rw-r--r-- | python/qpid/tests/messaging.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/python/qpid/tests/messaging.py b/python/qpid/tests/messaging.py index 7706ebbabe..7a2aca91db 100644 --- a/python/qpid/tests/messaging.py +++ b/python/qpid/tests/messaging.py @@ -84,6 +84,10 @@ class Base(Test): contents = self.drain(rcv) assert len(contents) == 0, "%s is supposed to be empty: %s" % (rcv, contents) + def assertPending(self, rcv, expected): + p = rcv.pending() + assert p == expected, "expected %s, got %s" % (expected, p) + def sleep(self): time.sleep(self.delay()) @@ -107,7 +111,8 @@ class SetupTests(Base): try: self.conn = Connection.open("localhost", 0) assert False, "connect succeeded" - except ConnectError: + except ConnectError, e: + # XXX: should verify that e includes appropriate diagnostic info pass class ConnectionTests(Base): @@ -237,7 +242,8 @@ class SessionTests(Base): # were requeued, and ack this time before closing self.ssn = self.conn.session() rcv = self.ssn.receiver("test-ack-queue") - assert contents == self.drain(rcv) + drained = self.drain(rcv) + assert contents == drained, "expected %s, got %s" % (contents, drained) self.ssn.acknowledge() self.ssn.close() @@ -319,7 +325,8 @@ class SessionTests(Base): txssn.acknowledge() else: txssn.rollback() - assert contents == self.drain(txrcv) + drained = self.drain(txrcv) + assert contents == drained, "expected %s, got %s" % (contents, drained) txssn.acknowledge() txssn.rollback() assert contents == self.drain(txrcv) @@ -467,19 +474,19 @@ class ReceiverTests(Base): def testCapacity(self): self.rcv.capacity = 5 self.rcv.start() - assert self.rcv.pending() == 0 + self.assertPending(self.rcv, 0) for i in range(15): self.send("testCapacity", i) self.sleep() - assert self.rcv.pending() == 5 + self.assertPending(self.rcv, 5) self.drain(self.rcv, limit = 5) self.sleep() - assert self.rcv.pending() == 5 + self.assertPending(self.rcv, 5) self.drain(self.rcv) - assert self.rcv.pending() == 0 + self.assertPending(self.rcv, 0) self.ssn.acknowledge() |