Fixhancement: trim whitespace for some text searches (#11357)

This commit is contained in:
shamoon
2025-11-14 08:09:09 -08:00
committed by GitHub
parent 005ef4fce6
commit 0219df5b67
4 changed files with 23 additions and 3 deletions

View File

@@ -941,6 +941,23 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
results = response.data["results"]
self.assertEqual(len(results), 0)
def test_documents_title_content_filter_strips_boundary_whitespace(self):
doc = Document.objects.create(
title="Testwort",
content="",
checksum="A",
mime_type="application/pdf",
)
response = self.client.get(
"/api/documents/",
{"title_content": " Testwort "},
)
self.assertEqual(response.status_code, status.HTTP_200_OK)
results = response.data["results"]
self.assertEqual(len(results), 1)
self.assertEqual(results[0]["id"], doc.id)
def test_document_permissions_filters(self):
"""
GIVEN: