'BlockingChannel: Test exchange_declare and exchange_delete'

def test(self):

    connection = self._connect()
    ch = connection.channel()
    name = ('TestExchangeDeclareAndDelete_' + uuid.uuid1().hex)
    frame = ch.exchange_declare(name, exchange_type='direct')
    self.addCleanup(connection.channel().exchange_delete, name)
    self.assertIsInstance(frame.method, pika.spec.Exchange.DeclareOk)
    frame = ch.exchange_declare(name, passive=True)
    self.assertIsInstance(frame.method, pika.spec.Exchange.DeclareOk)
    frame = ch.exchange_delete(name)
    self.assertIsInstance(frame.method, pika.spec.Exchange.DeleteOk)
    with self.assertRaises(pika.exceptions.ChannelClosed) as cm:
        ch.exchange_declare(name, passive=True)
    self.assertEqual(cm.exception.args[0], 404)
