Chore: Decrease backend test suite time (a little) (#14213)

* Chore: Speed up test setup by hashing passwords with MD5 and batching index writes

Don't use Django's default PBKDF2, about 600 ms per use and 110 uses across the suite. Switches to MD5 instead.

Also fixes a test that didn't batch update the search index

* Chore: Stop the invalid webhook params test from waiting on a Celery broker

test_workflow_webhook_action_url_invalid_params_headers left send_webhook.apply_async unpatched, so it tried to actually enqueu and waited for the timeout.
This commit is contained in:
Trenton H
2026-09-21 20:17:40 +00:00
committed by GitHub
parent cceaa559d4
commit cb85441c2f
3 changed files with 30 additions and 8 deletions
+11 -1
View File
@@ -4192,7 +4192,11 @@ class TestWorkflows(
expected_str = "Error occurred sending webhook"
self.assertIn(expected_str, cm.output[0])
def test_workflow_webhook_action_url_invalid_params_headers(self) -> None:
@mock.patch("documents.workflows.webhooks.send_webhook.apply_async")
def test_workflow_webhook_action_url_invalid_params_headers(
self,
mock_post,
) -> None:
"""
GIVEN:
- Document updated workflow with webhook action
@@ -4201,6 +4205,7 @@ class TestWorkflows(
- Document that matches is updated
THEN:
- Error is logged
- The webhook is still queued, with empty data and headers
"""
trigger = WorkflowTrigger.objects.create(
type=WorkflowTrigger.WorkflowTriggerType.DOCUMENT_UPDATED,
@@ -4237,6 +4242,11 @@ class TestWorkflows(
expected_str = "Error occurred parsing webhook headers"
self.assertIn(expected_str, cm.output[1])
mock_post.assert_called_once()
kwargs = mock_post.call_args.kwargs["kwargs"]
self.assertEqual(kwargs["data"], {})
self.assertEqual(kwargs["headers"], {})
@mock.patch("httpx.Client.post")
def test_workflow_webhook_send_webhook_task(self, mock_post) -> None:
mock_post.return_value = mock.Mock(