def test_raises_value_error_on_unknown_message(self): raw_message = amqp.Message( '{"fake": true}', content_type='application/json', ) self._channel.basic_publish(raw_message, routing_key=self._test_id) trans = AmqpTransport( host='localhost', username='******', password='******', queue=self._test_id, ) with self.assertRaises(ValueError): trans.fetch() # Close the connection and force requeue of the message. trans.close() raw_message = self._channel.basic_get(self._test_id) self._channel.basic_ack(raw_message.delivery_tag)