conftest.py gives you two test clients. Which one you reach for depends on
whether the request needs a CSRF token.
Feather enables CSRF protection by default, which is why there are two clients. The
csrf_client fixture fetches and includes the token so your tests don’t have to.Adding your own
Extendconftest.py for data that several tests need.
tests/conftest.py
Signing a user in
login_as(client, user) from feather.testing signs a user in on a test client, and
logout(client) signs them out. It works with the plain client and with csrf_client.
Don’t set _user_id on the session yourself. With session protection on, Flask-Login signs
out any session that lacks the request’s identifier, so a session set by hand looks signed
in and is signed out on the next request. login_as sets the identifier too.