def METHOD_NAME(client, patron_martigny, patron_martigny_data,
                             system_librarian_martigny, default_user_password):
    """Test for patron authenticate."""
    # parameters
    token = 'Or7DTg1WT34cLKuSMcS7WzhdhxtKklpTizb1Hn2H0aaV5Vig6nden63VEqBE'
    token_url_data = {'access_token': token}
    username = patron_martigny_data['username']
    password = default_user_password
    create_personal(
        name='token_test',
        user_id=system_librarian_martigny['user_id'],
        access_token=token
    )
    # Missing access_token parameter
    res, _ = postdata(
        client, 'api_patrons.patron_authenticate')
    assert res.status_code == 401
    # Missing parameters (username and password)
    res, _ = postdata(
        client, 'api_patrons.patron_authenticate', url_data=token_url_data)
    assert res.status_code == 400
    # User not found
    post_data = {'username': 'foo', 'password': 'bar'}
    res, _ = postdata(
        client,
        'api_patrons.patron_authenticate',
        post_data,
        url_data=token_url_data
    )
    assert res.status_code == 404
    # User found, bad password
    post_data = {'username': username, 'password': 'bar'}
    res, _ = postdata(
        client,
        'api_patrons.patron_authenticate',
        post_data,
        url_data=token_url_data
    )
    assert res.status_code == 401
    # User found
    post_data = {'username': username, 'password': password}
    res, output = postdata(
        client,
        'api_patrons.patron_authenticate',
        post_data,
        url_data=token_url_data
    )
    assert res.status_code == 200
    assert output['city'] == patron_martigny_data['city']
    assert output['fullname'] == patron_martigny_data['first_name'] + ' ' +\
        patron_martigny_data['last_name']
    assert 'blocked' not in output