jeudi 23 juillet 2020

How to test flask application with multiple logged in users?

I'm looking to test some routes which are @login_required. All the refs I can find suggest using a flask app test_client to first call actual login route for a user before sending requests to be tested. However the actual login routes use 3rd party oauth apis (Google & Facebook), so during testing I'd like to skip all that, ideally just manually create a dummy user and call flask_login.login_user directly.

I suppose I could expose a route in the test app only for exactly that purpose. Any suggestions?

Aucun commentaire:

Enregistrer un commentaire