Feature: parse advanced search with whoosh-compat and delete the handwritten translation (#14072)

* Feature: parse advanced search with whoosh-compat and delete the hand-written translator

* Don't cover these, they exist for defensive, but there's no other current diagnostic

* A mix of more no cover and tests

* Route SCHEMA_FIELD_MISSING into an error, not an HTTP 400
This commit is contained in:
Trenton H
2026-09-15 07:26:41 -07:00
committed by GitHub
parent e78521c912
commit 1f8b6c95b1
32 changed files with 5211 additions and 2477 deletions
+27
View File
@@ -2128,3 +2128,30 @@ class TestBulkEditAPI(DirectoriesMixin, APITestCase):
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(LogEntry.objects.filter(object_pk=self.doc1.id).count(), 2)
def test_api_bulk_edit_with_bad_search_query_returns_400(self) -> None:
"""
GIVEN:
- Bulk edit request selects documents via a saved-search query
filter
WHEN:
- The query contains a malformed field value (an invalid date)
THEN:
- The response is a 400 naming the bad value, exactly like the
search list endpoint, never a 500
"""
response = self.client.post(
"/api/documents/bulk_edit/",
json.dumps(
{
"all": True,
"filters": {"query": "added:notadate"},
"method": "set_storage_path",
"parameters": {"storage_path": self.sp1.id},
},
),
content_type="application/json",
)
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
self.assertIn(b"notadate", response.content)