'BlockingChannel: Test exchange_bind and exchange_unbind'

def test(self):

    connection = self._connect()
    ch = connection.channel()
    q_name = ('TestExchangeBindAndUnbind_q' + uuid.uuid1().hex)
    src_exg_name = ('TestExchangeBindAndUnbind_src_exg_' + uuid.uuid1().hex)
    dest_exg_name = ('TestExchangeBindAndUnbind_dest_exg_' + uuid.uuid1().hex)
    routing_key = 'TestExchangeBindAndUnbind'
    res = ch.confirm_delivery()
    self.assertIsNone(res)
    ch.exchange_declare(src_exg_name, exchange_type='direct')
    self.addCleanup(connection.channel().exchange_delete, src_exg_name)
    ch.exchange_declare(dest_exg_name, exchange_type='direct')
    self.addCleanup(connection.channel().exchange_delete, dest_exg_name)
    ch.queue_declare(q_name, auto_delete=True)
    self.addCleanup(self._connect().channel().queue_delete, q_name)
    ch.queue_bind(q_name, exchange=dest_exg_name, routing_key=routing_key)
    with self.assertRaises(pika.exceptions.UnroutableError):
        ch.publish(src_exg_name, routing_key, body='', mandatory=True)
    frame = ch.exchange_bind(destination=dest_exg_name, source=src_exg_name, routing_key=routing_key)
    self.assertIsInstance(frame.method, pika.spec.Exchange.BindOk)
    ch.publish(src_exg_name, routing_key, body='TestExchangeBindAndUnbind', mandatory=True)
    self._assert_exact_message_count_with_retries(channel=ch, queue=q_name, expected_count=1)
    frame = ch.exchange_unbind(destination=dest_exg_name, source=src_exg_name, routing_key=routing_key)
    self.assertIsInstance(frame.method, pika.spec.Exchange.UnbindOk)
    with self.assertRaises(pika.exceptions.UnroutableError):
        ch.publish(src_exg_name, routing_key, body='', mandatory=True)
