コード例 #1
0
def test_it_cancels_deletions(table, mock_running_job):
    mock_running_job.return_value = False
    response = handlers.cancel_handler(
        {
            "body": json.dumps({
                "Matches": [{
                    "DeletionQueueItemId": "id123"
                }],
            })
        }, SimpleNamespace())
    assert {"statusCode": 204, "headers": ANY} == response
コード例 #2
0
def test_it_prevents_cancelling_whilst_running_jobs(mock_running_job):
    mock_running_job.return_value = True
    response = handlers.cancel_handler(
        {
            "body":
            json.dumps({
                "Matches": [{
                    "MatchId": "test",
                    "CreatedAt": 123456789,
                }],
            })
        }, SimpleNamespace())

    assert 400 == response["statusCode"]
    assert "headers" in response