diff options
| author | Gordon Sim <gsim@apache.org> | 2006-10-31 18:33:40 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2006-10-31 18:33:40 +0000 |
| commit | bcc0879b6eee7e831e869334a792704e7e22c26f (patch) | |
| tree | db9019756d48d30122003d9f31f1e95bd5a9cc0b /qpid/python | |
| parent | 537b97e030358dc8bb7ff59942e0ddac8e46e5bd (diff) | |
| download | qpid-python-bcc0879b6eee7e831e869334a792704e7e22c26f.tar.gz | |
Hid locking within exchange registry, switched to shared_ptr for exchanges, added some extra error handling and tests.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@469599 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/python')
| -rw-r--r-- | qpid/python/tests/exchange.py | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/qpid/python/tests/exchange.py b/qpid/python/tests/exchange.py index 8f3504b15e..a823718f03 100644 --- a/qpid/python/tests/exchange.py +++ b/qpid/python/tests/exchange.py @@ -23,6 +23,7 @@ Test classes ending in 'RuleTests' are derived from rules in amqp.xml. import Queue, logging from qpid.testlib import TestBase from qpid.content import Content +from qpid.client import Closed class StandardExchangeVerifier: @@ -207,10 +208,14 @@ class DeclareMethodTypeFieldSupportRuleTests(TestBase): class DeclareMethodPassiveFieldNotFoundRuleTests(TestBase): """ If set, and the exchange does not already exist, the server MUST raise a - channel exception with reply code 404 (not found). - - + channel exception with reply code 404 (not found). """ + def test(self): + try: + self.channel.exchange_declare(exchange="humpty_dumpty", passive=True) + self.fail("Expected 404 for passive declaration of unknown exchange.") + except Closed, e: + self.assertChannelException(404, e.args[0]) class DeclareMethodDurableFieldSupportRuleTests(TestBase): @@ -292,3 +297,28 @@ class HeadersExchangeTests(TestBase): self.myBasicPublish({"irrelevant":0}) self.assertEmpty(self.q) + +class MiscellaneousErrorsTests(TestBase): + """ + Test some miscellaneous error conditions + """ + def testTypeNotKnown(self): + try: + self.channel.exchange_declare(exchange="test_type_not_known_exchange", type="invalid_type") + self.fail("Expected 503 for declaration of unknown exchange type.") + except Closed, e: + self.assertConnectionException(503, e.args[0]) + + def testDifferentDeclaredType(self): + self.channel.exchange_declare(exchange="test_different_declared_type_exchange", type="direct") + try: + self.channel.exchange_declare(exchange="test_different_declared_type_exchange", type="topic") + self.fail("Expected 507 for redeclaration of exchange with different type.") + except Closed, e: + self.assertConnectionException(507, e.args[0]) + #cleanup + other = self.connect() + c2 = other.channel(1) + c2.channel_open() + c2.exchange_delete(exchange="test_different_declared_type_exchange") + |
