Example #1
0
def auth_headers(app):
    base_auth_token = _jwt.create_jwt(BASE_AUTH_CLAIMS, TOKEN_HEADER)
    full_auth_token = _jwt.create_jwt(FULL_AUTH_CLAIMS, TOKEN_HEADER)
    view_only_auth_token = _jwt.create_jwt(VIEW_ONLY_AUTH_CLAIMS, TOKEN_HEADER)
    return {
        'base_auth_header': {
            'Authorization': 'Bearer ' + base_auth_token
        },
        'full_auth_header': {
            'Authorization': 'Bearer ' + full_auth_token
        },
        'view_only_auth_header': {
            'Authorization': 'Bearer ' + view_only_auth_token
        },
    }
Example #2
0
def test_get_user_info(test_client):
    User._test_mode = False

    auth_token = jwt.create_jwt(VIEW_ONLY_AUTH_CLAIMS, TOKEN_HEADER)
    with mock.patch.object(jwt,
                           'get_token_auth_header',
                           return_value=auth_token):
        assert User().get_user_raw_info() == VIEW_ONLY_AUTH_CLAIMS
Example #3
0
def auth_headers(app):
    base_auth_token = _jwt.create_jwt(BASE_AUTH_CLAIMS, TOKEN_HEADER)
    full_auth_token = _jwt.create_jwt(FULL_AUTH_CLAIMS, TOKEN_HEADER)
    view_only_auth_token = _jwt.create_jwt(VIEW_ONLY_AUTH_CLAIMS, TOKEN_HEADER)
    create_only_auth_token = _jwt.create_jwt(CREATE_ONLY_AUTH_CLAIMS,
                                             TOKEN_HEADER)
    admin_only_auth_token = _jwt.create_jwt(ADMIN_ONLY_AUTH_CLAIMS,
                                            TOKEN_HEADER)
    proponent_only_auth_token = _jwt.create_jwt(PROPONENT_ONLY_AUTH_CLAIMS,
                                                TOKEN_HEADER)
    nros_vfcbc_only_auth_token = _jwt.create_jwt(NROS_VFCBC_AUTH_CLAIMS,
                                                 TOKEN_HEADER)
    return {
        'base_auth_header': {
            'Authorization': 'Bearer ' + base_auth_token
        },
        'full_auth_header': {
            'Authorization': 'Bearer ' + full_auth_token
        },
        'view_only_auth_header': {
            'Authorization': 'Bearer ' + view_only_auth_token
        },
        'create_only_auth_header': {
            'Authorization': 'Bearer ' + create_only_auth_token
        },
        'admin_only_auth_header': {
            'Authorization': 'Bearer ' + admin_only_auth_token
        },
        'proponent_only_auth_header': {
            'Authorization': 'Bearer ' + proponent_only_auth_token
        },
        'nros_vfcbc_auth_header': {
            'Authorization': 'Bearer ' + nros_vfcbc_only_auth_token
        }
    }