level12 / keg-auth

Robust authentication system for Keg

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`AuthTestApp` Can't Be Used as a Context Manager

calebsyring opened this issue · comments

Flask documentation says that you should use the test client as a context manager for accessing values in the session after a request. Trying to do that currently results in an error because AuthTestApp does not define __enter__. session_transaction still works and can be used as a workaround.

Keg uses WebTest by way of Flask-WebTest. Flask docs related to testing assume the use of Flask's Client and therefore don't usually apply to any of our testing scenarios in the Keg ecosystem.

WebTest and Flask's Client are for the same purpose but have different implementations and request/response objects.

It could still be useful to use the app as a context manager, just want to make sure the distinction between Client and WebTest is remembered.