Describe the bug
While running tests, the following was observed
2025-07-20 23:39:11,434 - [N/A] - ERROR - app.api.routes.threads - Callback failed: 403 Client Error: Forbidden for url: http://example.com/callback
Traceback (most recent call last):
File "/Users/nishikayadav/Desktop/platform/backend/app/api/routes/threads.py", line 44, in send_callback
response.raise_for_status()
File "/Users/nishikayadav/Desktop/platform/backend/.venv/lib/python3.12/site-packages/requests/models.py", line 1024, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: http://example.com/callback
2025-07-20 23:39:11,446 - [N/A] - INFO - app.api.routes.responses - Callback sent successfully, assistant=assi********ific, project_id=195
✅ `test_responses_endpoint_success` took **75.67 seconds** to run.
Two main issues need to be addressed:
- The callback to http://example.com/callback is failing with a 403 Forbidden error, but is still logged as "sent successfully".
- The test function
test_responses_endpoint_success is taking over one minute to run, which is unusually long for a unit test and slows down the test suite.
Suggested Solution:
Mock the external HTTP call to the callback endpoint (e.g., using pytest-mock, responses, or similar library) so that:
-
The test does not make a real network request.
-
The mocked response can simulate a successful (200 OK) callback.
-
The test remains fast and reliable.
Describe the bug
While running tests, the following was observed
Two main issues need to be addressed:
test_responses_endpoint_successis taking over one minute to run, which is unusually long for a unit test and slows down the test suite.Suggested Solution:
Mock the external HTTP call to the callback endpoint (e.g., using pytest-mock, responses, or similar library) so that:
The test does not make a real network request.
The mocked response can simulate a successful (200 OK) callback.
The test remains fast and reliable.