async def test_process_success_from_requeue_to_ack(self):
     message = RabbitMQMessage(body={},
                               delivery_tag=10,
                               on_success=Actions.REQUEUE)
     message.accept()
     await message.process_success(self.queue_mock)
     self.queue_mock.ack.assert_awaited_with(delivery_tag=10)
     self.queue_mock.reject.assert_not_awaited()
Beispiel #2
0
 async def test_process_success_from_reject_to_ack(self):
     message = RabbitMQMessage(
         delivery_tag=10,
         on_success=Actions.REJECT,
         amqp_message=self.amqp_message,
     )
     message.accept()
     await message.process_success()
     self.amqp_message.ack.assert_awaited_with()
     self.amqp_message.reject.assert_not_awaited()
Beispiel #3
0
    async def test_process_exception_from_requeue_to_ack(self):
        message = RabbitMQMessage(
            delivery_tag=10,
            on_exception=Actions.REQUEUE,
            amqp_message=self.amqp_message,
        )
        message.accept()

        await message.process_exception()
        self.amqp_message.ack.assert_awaited_with()
        self.amqp_message.reject.assert_not_awaited()
 def test_mark_message_to_be_acked(self):
     message = RabbitMQMessage({}, 10)
     message._do_ack = False
     message.accept()
     self.assertTrue(message._do_ack)