diff options
| author | Gordon Sim <gsim@apache.org> | 2007-07-03 15:18:03 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2007-07-03 15:18:03 +0000 |
| commit | 84856db9f9312ba65f82a129d7f2761ad80d83fc (patch) | |
| tree | 33fabe547f097e23033f810d607150c75d2a6343 /python/tests_0-9 | |
| parent | 338f2196c07ea6ce2cd40941bca9ef11e95be2bf (diff) | |
| download | qpid-python-84856db9f9312ba65f82a129d7f2761ad80d83fc.tar.gz | |
Changes to python tests for QPID-533 and QPID-407.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@552872 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/tests_0-9')
| -rw-r--r-- | python/tests_0-9/basic.py | 5 | ||||
| -rw-r--r-- | python/tests_0-9/message.py | 10 | ||||
| -rw-r--r-- | python/tests_0-9/queue.py | 34 |
3 files changed, 45 insertions, 4 deletions
diff --git a/python/tests_0-9/basic.py b/python/tests_0-9/basic.py index 140576540a..0ad06e10a3 100644 --- a/python/tests_0-9/basic.py +++ b/python/tests_0-9/basic.py @@ -218,10 +218,11 @@ class BasicTests(TestBase): channel.basic_ack(delivery_tag=msg4.delivery_tag, multiple=False) #Four channel.basic_cancel(consumer_tag=subscription.consumer_tag) - subscription2 = channel.basic_consume(queue="test-requeue") - queue2 = self.client.queue(subscription2.consumer_tag) channel.basic_recover(requeue=True) + + subscription2 = channel.basic_consume(queue="test-requeue") + queue2 = self.client.queue(subscription2.consumer_tag) msg3b = queue2.get(timeout=1) msg5b = queue2.get(timeout=1) diff --git a/python/tests_0-9/message.py b/python/tests_0-9/message.py index 8da9978792..b25016e680 100644 --- a/python/tests_0-9/message.py +++ b/python/tests_0-9/message.py @@ -219,10 +219,14 @@ class MessageTests(TestBase): msg4.ok() #Four channel.message_cancel(destination="consumer_tag") - channel.message_consume(queue="test-requeue", destination="consumer_tag") - queue2 = self.client.queue("consumer_tag") + #publish a new message + channel.message_transfer(routing_key="test-requeue", body="Six") + #requeue unacked messages (Three and Five) channel.message_recover(requeue=True) + + channel.message_consume(queue="test-requeue", destination="consumer_tag") + queue2 = self.client.queue("consumer_tag") msg3b = queue2.get(timeout=1) msg5b = queue2.get(timeout=1) @@ -233,6 +237,8 @@ class MessageTests(TestBase): self.assertEqual(True, msg3b.redelivered) self.assertEqual(True, msg5b.redelivered) + self.assertEqual("Six", queue2.get(timeout=1).body) + try: extra = queue2.get(timeout=1) self.fail("Got unexpected message in second queue: " + extra.body) diff --git a/python/tests_0-9/queue.py b/python/tests_0-9/queue.py index b94b8b7739..e7fe0b3ed4 100644 --- a/python/tests_0-9/queue.py +++ b/python/tests_0-9/queue.py @@ -304,3 +304,37 @@ class QueueTests(TestBase): self.assertChannelException(404, e.args[0]) + def test_autodelete_shared(self): + """ + Test auto-deletion (of non-exclusive queues) + """ + channel = self.channel + other = self.connect() + channel2 = other.channel(1) + channel2.channel_open() + + channel.queue_declare(queue="auto-delete-me", auto_delete=True) + + #consume from both channels + reply = channel.basic_consume(queue="auto-delete-me", no_ack=True) + channel2.basic_consume(queue="auto-delete-me", no_ack=True) + + #implicit cancel + channel2.channel_close() + + #check it is still there + channel.queue_declare(queue="auto-delete-me", passive=True) + + #explicit cancel => queue is now unused again: + channel.basic_cancel(consumer_tag=reply.consumer_tag) + + #NOTE: this assumes there is no timeout in use + + #check that it has gone be declaring passively + try: + channel.queue_declare(queue="auto-delete-me", passive=True) + self.fail("Expected queue to have been deleted") + except Closed, e: + self.assertChannelException(404, e.args[0]) + + |
