コード例 #1
0
def test_it_retrieves_all_items_with_size_and_pagination(table):
    table.scan.return_value = {
        "Items": [{
            "DeletionQueueItemId": "id123",
            "MatchId": "foo",
            "DataMappers": [],
            "CreatedAt": 123456789
        }]
    }
    response = handlers.get_handler(
        {"queryStringParameters": {
            "page_size": "1",
            "start_at": "id000"
        }}, SimpleNamespace())
    assert {
        "statusCode":
        200,
        "body":
        json.dumps({
            "MatchIds": [{
                "DeletionQueueItemId": "id123",
                "MatchId": "foo",
                "DataMappers": [],
                "CreatedAt": 123456789
            }],
            "NextStart":
            "id123"
        }),
        "headers":
        ANY
    } == response
    table.scan.assert_called_with(
        Limit=1, ExclusiveStartKey={"DeletionQueueItemId": "id000"})
コード例 #2
0
def test_it_retrieves_all_items(table):
    table.scan.return_value = {"Items": []}
    response = handlers.get_handler({}, SimpleNamespace())
    assert {
        "statusCode": 200,
        "body": json.dumps({
            "MatchIds": [],
            "NextStart": None
        }),
        "headers": ANY
    } == response
    table.scan.assert_called_with(Limit=10)