July 2017
Beginner to intermediate
340 pages
7h 43m
English
If you do some messaging with Pika and RabbitMQ, the Pika library directly uses the socket module to interact with the server, and that makes it painful to mock because we would need to track what data is sent and received over the wire.
Like for Celery, you could just run a local RabbitMQ server for your tests--Travis-CI also making it available (https://docs.travis-ci.com/user/database-setup/).
Sending messages, in that case, is done as usual, and you can create a script that picks them in the Rabbit queues to verify them.
When you need to test a process where an event is received from RabbitMQ, if that happens via an HTTP call, as in our little AMQP-to-HTTP bridge, you can simply manually trigger the events ...
Read now
Unlock full access