I have a pytest test from a flask application that looks like:
def test_logout_redirect(client, login, credentials_admin):
with client as c:
login(c, credentials_admin)
r = c.get(url_for('main.logout'), follow_redirects=True)
assert r.status_code == 200
assert request.path == url_for('main.login')
assert b'Log In' in r.data
When the user logs out, the session is cleared and it redirects them to the login page. The log in route checks if the session has a user id, and if so it redirects them to the homepage.
Therefore the test is trying to assert that the session is cleared after logging out and the user is redirected to the login page. This test was passing in 0.14.1.
However after upgrading the test fails. It seems like the user ID is back in the session after it has been cleared and therefore the user ends up in the homepage.
I am encountering this behaviour only when using the test client, which I am invoking with flask's app.test_client().
I have a pytest test from a flask application that looks like:
When the user logs out, the session is cleared and it redirects them to the login page. The log in route checks if the session has a user id, and if so it redirects them to the homepage.
Therefore the test is trying to assert that the session is cleared after logging out and the user is redirected to the login page. This test was passing in 0.14.1.
However after upgrading the test fails. It seems like the user ID is back in the session after it has been cleared and therefore the user ends up in the homepage.
I am encountering this behaviour only when using the test client, which I am invoking with flask's app.test_client().