def METHOD_NAME(self, request):
    """Extract the generated event tracking context for the given request."""
    self.track_middleware.process_request(request)
    try:
        captured_context = tracker.get_tracker().resolve_context()
    finally:
        self.track_middleware.process_response(request, None)
    assert tracker.get_tracker().resolve_context() == {}
    return captured_context