bottleneckcrm/backend/webhooks/middleware.py
Ashwin e26ab380fc Add unit tests for ticket board provider, status settable, web forms, CSV import, deal aging badge, and tickets selection
- Implement comprehensive tests for the ticket board provider to validate kanban and pipeline modes, including ticket movement and error handling.
- Create tests for ticket status settable to ensure proper status selection logic.
- Enhance web form model tests to cover ticket-specific fields and submission behavior.
- Introduce CSV import sheet tests to verify file handling and error reporting.
- Add deal aging badge tests to confirm correct display of aging statuses.
- Implement tickets selection tests to ensure UI responsiveness and functionality at various screen sizes.
2026-09-26 16:53:22 +05:30

19 lines
664 B
Python

from webhooks.emit import flush
class WebhookEventsMiddleware:
"""Queue the webhook events a request produced, once its view has returned.
Must sit after `crum.CurrentRequestUserMiddleware` (which is what lets
`webhooks.emit.record` find the request) and after `RequireOrgContext`, so
the flush runs while the request's RLS context is still set. See the
module docstring of `webhooks.emit` for why events wait for this point.
"""
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
response = self.get_response(request)
flush(request)
return response