def test_basic(sentry_init, crashing_app, capture_events): sentry_init(send_default_pii=True) app = lambda environ, start_response: run_wsgi_app(crashing_app, environ, start_response) client = Client(app) events = capture_events() with pytest.raises(ZeroDivisionError): client.get("/") event, = events assert event["request"] == { "env": { "SERVER_NAME": "localhost", "SERVER_PORT": "80" }, "headers": { "Content-Length": "0", "Content-Type": "", "Host": "localhost" }, "method": "GET", "query_string": "", }
def sentry_patched_wsgi_call(self, environ, start_response): hub = Hub.current integration = hub.get_integration(PyramidIntegration) if integration is None: return old_wsgi_call(self, environ, start_response) return run_wsgi_app(lambda *a, **kw: old_wsgi_call(self, *a, **kw), environ, start_response)
def sentry_patched_wsgi_handler(self, environ, start_response): if Hub.current.get_integration(DjangoIntegration) is None: return old_app(self, environ, start_response) return run_wsgi_app(lambda *a, **kw: old_app(self, *a, **kw), environ, start_response)
def sentry_patched_wsgi_app(self, environ, start_response): return run_wsgi_app(lambda *a, **kw: old_app(self, *a, **kw), environ, start_response)