def METHOD_NAME(client, patron_sion, default_user_password):
    """Test login with several scenarios."""
    patron_sion = patron_sion.dumps()
    # user does not exists
    res, _ = postdata(
        client,
        'invenio_accounts_rest_auth.login',
        {
            'email': 'not@exist.com',
            'password': ''
        }
    )
    assert res.status_code == 400
    data = get_json(res)
    assert data['message'] == 'Invalid user or password'
    # wrong password
    res, _ = postdata(
        client,
        'invenio_accounts_rest_auth.login',
        {
            'email': patron_sion.get('email'),
            'password': 'bad'
        }
    )
    assert res.status_code == 400
    data = get_json(res)
    assert data['message'] == gettext('INVALID_USER_OR_PASSWORD')
    # login by email
    res, _ = postdata(
        client,
        'invenio_accounts_rest_auth.login',
        {
            'email': patron_sion.get('email'),
            'password': default_user_password
        }
    )
    data = get_json(res)
    assert res.status_code == 200
    assert data.get('id')
    # logout for the next test
    client.post(url_for('invenio_accounts_rest_auth.logout'))
    # login by username
    res, _ = postdata(
        client,
        'invenio_accounts_rest_auth.login',
        {
            'email': patron_sion.get('username'),
            'password': default_user_password
        }
    )
    data = get_json(res)
    assert res.status_code == 200
    assert data.get('id')
    # logout for the next test
    client.post(url_for('invenio_accounts_rest_auth.logout'))