in qpid_tests/broker_0_9/query.py [0:0]
def binding_query_with_key(self, exchange_name):
channel = self.channel
#setup: create two queues
channel.queue_declare(queue="used-queue", exclusive=True)
channel.queue_declare(queue="unused-queue", exclusive=True)
channel.queue_bind(exchange=exchange_name, queue="used-queue", routing_key="used-key")
# test detection of any binding to specific queue
response = channel.binding_query(exchange=exchange_name, queue="used-queue")
self.assertEqual(False, response.exchange_not_found)
self.assertEqual(False, response.queue_not_found)
self.assertEqual(False, response.queue_not_matched)
# test detection of specific binding to any queue
response = channel.binding_query(exchange=exchange_name, routing_key="used-key")
self.assertEqual(False, response.exchange_not_found)
self.assertEqual(False, response.queue_not_found)
self.assertEqual(False, response.key_not_matched)
# test detection of specific binding to specific queue
response = channel.binding_query(exchange=exchange_name, queue="used-queue", routing_key="used-key")
self.assertEqual(False, response.exchange_not_found)
self.assertEqual(False, response.queue_not_found)
self.assertEqual(False, response.queue_not_matched)
self.assertEqual(False, response.key_not_matched)
# test unmatched queue, unspecified binding
response = channel.binding_query(exchange=exchange_name, queue="unused-queue")
self.assertEqual(False, response.exchange_not_found)
self.assertEqual(False, response.queue_not_found)
self.assertEqual(True, response.queue_not_matched)
# test unspecified queue, unmatched binding
response = channel.binding_query(exchange=exchange_name, routing_key="unused-key")
self.assertEqual(False, response.exchange_not_found)
self.assertEqual(False, response.queue_not_found)
self.assertEqual(True, response.key_not_matched)
# test matched queue, unmatched binding
response = channel.binding_query(exchange=exchange_name, queue="used-queue", routing_key="unused-key")
self.assertEqual(False, response.exchange_not_found)
self.assertEqual(False, response.queue_not_found)
self.assertEqual(False, response.queue_not_matched)
self.assertEqual(True, response.key_not_matched)
# test unmatched queue, matched binding
response = channel.binding_query(exchange=exchange_name, queue="unused-queue", routing_key="used-key")
self.assertEqual(False, response.exchange_not_found)
self.assertEqual(False, response.queue_not_found)
self.assertEqual(True, response.queue_not_matched)
self.assertEqual(False, response.key_not_matched)
# test unmatched queue, unmatched binding
response = channel.binding_query(exchange=exchange_name, queue="unused-queue", routing_key="unused-key")
self.assertEqual(False, response.exchange_not_found)
self.assertEqual(False, response.queue_not_found)
self.assertEqual(True, response.queue_not_matched)
self.assertEqual(True, response.key_not_matched)
#test exchange not found
self.assertEqual(True, channel.binding_query(exchange="unknown-exchange").exchange_not_found)
#test queue not found
self.assertEqual(True, channel.binding_query(exchange=exchange_name, queue="unknown-queue").queue_not_found)