def test_redirect_after_logout():
    auth, app, user = _get_flask_app()
    client = app.test_client()

    auth.login(user)
    url = '{0}?_csrf_token={1}'.format(auth.url_sign_out, auth.get_csrf_token())
    r = client.get(url)
    assert r.status == '303 SEE OTHER'
    assert auth.session not in auth.session_key

    auth.login(user)
    auth.sign_out_redirect = '/test/'
    url = '{0}?_csrf_token={1}'.format(auth.url_sign_out, auth.get_csrf_token())
    r = client.get(url)
    assert r.status == '303 SEE OTHER'
    assert r.location.endswith('/test/')
    assert auth.session_key not in auth.session

    auth.login(user)
    auth.sign_out_redirect = lambda request: '/dynamic/'
    url = '{0}?_csrf_token={1}'.format(auth.url_sign_out, auth.get_csrf_token())
    r = client.get(url)
    assert r.status == '303 SEE OTHER'
    assert r.location.endswith('/dynamic/')
    assert auth.session_key not in auth.session
dataset/ETHPy150Open jpscaletti/authcode/tests/test_views.py/test_redirect_after_logout/swapped operands of `not in`