From b2fec850e199f73a64c42f93ce8c95f7a81d518d Mon Sep 17 00:00:00 2001 From: Kim van der Riet Date: Wed, 28 Oct 2009 20:24:51 +0000 Subject: 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 --- python/tests_0-10/exchange.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'python') 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): -- cgit v1.2.1