'BlockingChannel.publish amd basic_publish unroutable message with pubacks'

def test(self):

    connection = self._connect()
    ch = connection.channel()
    exg_name = ('TestPublishAndBasicPublishUnroutable_exg_' + uuid.uuid1().hex)
    routing_key = 'TestPublishAndBasicPublishUnroutable'
    res = ch.confirm_delivery()
    self.assertIsNone(res)
    ch.exchange_declare(exg_name, exchange_type='direct')
    self.addCleanup(connection.channel().exchange_delete, exg_name)
    res = ch.basic_publish(exg_name, routing_key=routing_key, body='', mandatory=True)
    self.assertEqual(res, False)
    msg2_headers = dict(test_name='TestPublishAndBasicPublishWithPubacksUnroutable')
    msg2_properties = pika.spec.BasicProperties(headers=msg2_headers)
    with self.assertRaises(pika.exceptions.UnroutableError) as cm:
        ch.publish(exg_name, routing_key=routing_key, body='', properties=msg2_properties, mandatory=True)
    (msg,) = cm.exception.messages
    self.assertIsInstance(msg, blocking_connection.ReturnedMessage)
    self.assertIsInstance(msg.method, pika.spec.Basic.Return)
    self.assertEqual(msg.method.reply_code, 312)
    self.assertEqual(msg.method.exchange, exg_name)
    self.assertEqual(msg.method.routing_key, routing_key)
    self.assertIsInstance(msg.properties, pika.BasicProperties)
    self.assertEqual(msg.properties.headers, msg2_headers)
    self.assertEqual(msg.body, as_bytes(''))
