def test_it_adds_composite_to_queue(table):
    mid = [{"Column": "first_name", "Value": "test"}]
    response = handlers.enqueue_handler(
        {
            "body":
            json.dumps({
                "MatchId": mid,
                "Type": "Composite",
                "DataMappers": ["a"],
            }),
            "requestContext":
            autorization_mock,
        },
        SimpleNamespace(),
    )
    assert 201 == response["statusCode"]
    assert {
        "DeletionQueueItemId": ANY,
        "MatchId": mid,
        "Type": "Composite",
        "CreatedAt": ANY,
        "DataMappers": ["a"],
        "CreatedBy": {
            "Username": "******",
            "Sub": "cognitoSub"
        },
    } == json.loads(response["body"])
示例#2
0
def test_it_provides_default_data_mappers(table):
    response = handlers.enqueue_handler(
        {
            "body": json.dumps({
                "MatchId": "test",
            }),
            "requestContext": autorization_mock
        }, SimpleNamespace())

    assert 201 == response["statusCode"]
    assert {
        "DeletionQueueItemId": ANY,
        "MatchId": "test",
        "CreatedAt": ANY,
        "DataMappers": [],
        "CreatedBy": {
            "Username": "******",
            "Sub": "cognitoSub"
        }
    } == json.loads(response["body"])