def test_listener_subscribe_basic_qos(monkeypatch): channel = pika.Channel() channel.basic_qos = Mock() rabbitmq_adapter.listener.subscribe(channel, mocked_handler) channel.basic_qos.assert_called_once_with(prefetch_count=config.rabbitmq.prefetch.count)
def test_listener_subscribe_basic_consume(monkeypatch): channel = pika.Channel() channel.basic_consume = Mock() rmqpy.listener.subscribe(channel, mocked_handler) channel.basic_consume.assert_called_once_with( queue=config.rabbitmq.queue, on_message_callback=mocked_handler)
def test_listener_subscribe_queue_bind(monkeypatch): channel = pika.Channel() channel.queue_bind = Mock() rmqpy.listener.subscribe(channel, mocked_handler) channel.queue_bind.assert_called_once_with( queue=config.rabbitmq.queue, exchange=config.rabbitmq.exchange)
def test_listener_subscribe_queue_declared(monkeypatch): channel = pika.Channel() channel.queue_declare = Mock() rmqpy.listener.subscribe(channel, mocked_handler) channel.queue_declare.assert_called_once_with(queue=config.rabbitmq.queue, durable=True)
def test_sender_publish_new_message(monkeypatch): channel = pika.Channel() channel.basic_publish = Mock() rabbitmq_adapter.sender.publish(channel, 'MORTY') channel.basic_publish.assert_called_once_with( routing_key=config.rabbitmq.queue, exchange=config.rabbitmq.exchange, body='MORTY')