summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorKim van der Riet <kpvdr@apache.org>2009-10-28 20:24:51 +0000
committerKim van der Riet <kpvdr@apache.org>2009-10-28 20:24:51 +0000
commitb2fec850e199f73a64c42f93ce8c95f7a81d518d (patch)
tree48258afa30545a8b20fb1825ab868e9ad35c59d6 /python
parent77a0927ded844a58fead8ab39a60644c8211c5d2 (diff)
downloadqpid-python-b2fec850e199f73a64c42f93ce8c95f7a81d518d.tar.gz
Fixed lack of checking for reserved exchange names that start with "amq." according to the AMQP spec. Added a python test for this functionality.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@830751 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python')
-rw-r--r--python/tests_0-10/exchange.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/python/tests_0-10/exchange.py b/python/tests_0-10/exchange.py
index 738e3c4def..e2c84848f7 100644
--- a/python/tests_0-10/exchange.py
+++ b/python/tests_0-10/exchange.py
@@ -271,6 +271,28 @@ class DeclareMethodExchangeFieldReservedRuleTests(TestHelper):
"""
+ def test(self):
+ try:
+ self.session.exchange_declare(exchange="amq.", type="direct")
+ self.fail("Expected not allowed error (530) for exchanges starting with \"amq.\".")
+ except SessionException, e:
+ self.assertEquals(e.args[0].error_code, 530)
+ # connection closed, reopen it
+ self.tearDown()
+ self.setUp()
+ try:
+ self.session.exchange_declare(exchange="amq.abc123", type="direct")
+ self.fail("Expected not allowed error (530) for exchanges starting with \"amq.\".")
+ except SessionException, e:
+ self.assertEquals(e.args[0].error_code, 530)
+ # connection closed, reopen it
+ self.tearDown()
+ self.setUp()
+ # The following should be legal:
+ self.session.exchange_declare(exchange="amq", type="direct")
+ self.session.exchange_declare(exchange=".amq.", type="direct")
+ self.session.exchange_declare(exchange="abc.amq.", type="direct")
+ self.session.exchange_declare(exchange="abc.amq.def", type="direct")
class DeclareMethodTypeFieldTypedRuleTests(TestHelper):