Skip to content

Instantly share code, notes, and snippets.

@sportebois
Created October 13, 2020 16:44
Show Gist options
  • Save sportebois/fe2be99f27cef360961558ade6af6914 to your computer and use it in GitHub Desktop.
Save sportebois/fe2be99f27cef360961558ade6af6914 to your computer and use it in GitHub Desktop.
Flask custom test client class overridden open()
from flask.testing import FlaskClient
class ApiTestClient(FlaskClient):
def open(self, *args, **kw):
resp: Response = super().open(*args, **kw)
# Send a copy of the request to the sink so that it’s visible for the Akita Agent
resp.freeze()
_publish_to_exposer(kw, deepcopy(resp))
return resp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment