예제 #1
0
def test_ack():
    """
    Consumer delegates to SQS client.

    """
    def loader(metadata):
        return dict(
            sqs_consumer=dict(
                sqs_queue_url=FOO_QUEUE_URL,
                visibility_timeout_seconds=None,
            ),
            pubsub_message_codecs=dict(default=FooSchema, ),
        )

    graph = create_object_graph("example", testing=True, loader=loader)
    message = SQSMessage(
        consumer=graph.sqs_consumer,
        content=None,
        media_type=FooSchema.MEDIA_TYPE,
        message_id=MESSAGE_ID,
        receipt_handle=RECEIPT_HANDLE,
    )
    message.ack()
    graph.sqs_consumer.sqs_client.delete_message.assert_called_with(
        QueueUrl='foo-queue-url',
        ReceiptHandle=RECEIPT_HANDLE,
    )
예제 #2
0
def test_ack():
    """
    Consumer delegates to SQS client.

    """
    graph = ExampleDaemon.create_for_testing().graph
    message = SQSMessage(
        consumer=graph.sqs_consumer,
        content=None,
        media_type=DerivedSchema.MEDIA_TYPE,
        message_id=MESSAGE_ID,
        receipt_handle=RECEIPT_HANDLE,
    )
    message.ack()
    graph.sqs_consumer.sqs_client.delete_message.assert_called_with(
        QueueUrl="queue",
        ReceiptHandle=RECEIPT_HANDLE,
    )