diff options
author | Gordon Sim <gsim@apache.org> | 2006-09-22 09:53:47 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2006-09-22 09:53:47 +0000 |
commit | 488beb5a2a072afe2be0c7a1f679a5049f3b2e19 (patch) | |
tree | ec5d2f70029800a12d3fdd6a91cc0169010a85ac /python/tests/basic.py | |
parent | 6225325010374b21f589e4daba8ddd48564786fa (diff) | |
download | qpid-python-488beb5a2a072afe2be0c7a1f679a5049f3b2e19.tar.gz |
Added tests for basic_cancel and for handling of invalid channel ids.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@448881 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/tests/basic.py')
-rw-r--r-- | python/tests/basic.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/python/tests/basic.py b/python/tests/basic.py index c3a2414eac..75d49ec805 100644 --- a/python/tests/basic.py +++ b/python/tests/basic.py @@ -113,3 +113,27 @@ class BasicTests(TestBase): except Closed, e: self.assertConnectionException(530, e.args[0]) + def test_basic_cancel(self): + """ + Test compliance of the basic.cancel method + """ + channel = self.channel + #setup, declare a queue: + channel.queue_declare(queue="test-queue-4", exclusive=True) + channel.basic_consume(consumer_tag="my-consumer", queue="test-queue-4") + channel.basic_publish(routing_key="test-queue-4", content=Content("One")) + + #cancel should stop messages being delivered + channel.basic_cancel(consumer_tag="my-consumer") + channel.basic_publish(routing_key="test-queue-4", content=Content("Two")) + myqueue = self.client.queue("my-consumer") + msg = myqueue.get(timeout=1) + self.assertEqual("One", msg.content.body) + try: + msg = myqueue.get(timeout=1) + self.fail("Got message after cancellation: " + msg) + except Empty: None + + #cancellation of non-existant consumers should be handled without error + channel.basic_cancel(consumer_tag="my-consumer") + channel.basic_cancel(consumer_tag="this-never-existed") |