mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-09-14 13:47:58 +00:00
Feature: parse advanced search with whoosh-compat and delete the hand-written translator
This commit is contained in:
committed by
Trenton Holmes
parent
e8f0f9cccd
commit
1def91f93e
@@ -2059,3 +2059,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)
|
||||
|
||||
Reference in New Issue
Block a user