mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-08-19 17:23:21 +00:00
refactor: minor cleanup from final whoosh-compat migration review
- Update stale test comments in test_query.py that described string rewriting / raw-query fallback behavior that no longer exists post whoosh-compat migration; rename test_date_rewriting_applied_before_tantivy_parse to test_date_keyword_resolves_without_raising to match. - views.py: move the local MultipleSearchQueryErrors import up into the existing local-import block near the top of list(), consistent with the other documents.search imports there, instead of importing it again inside the except SearchQueryError clause. - test_api_search.py: assert response.status_code explicitly before indexing into response.data["results"] in test_search_added_previous_month_excludes_next_period_start, and tie the xfail marker to AssertionError instead of the incidental KeyError that indexing a 400 response's missing "results" key produced.
This commit is contained in:
@@ -731,7 +731,7 @@ class TestDocumentSearchApi(DirectoriesMixin, APITestCase):
|
||||
"which already quotes. CONFIRMED REGRESSION vs whoosh-compat "
|
||||
"migration; see task-10-report.md."
|
||||
),
|
||||
raises=KeyError,
|
||||
raises=AssertionError,
|
||||
)
|
||||
def test_search_added_previous_month_excludes_next_period_start(self) -> None:
|
||||
"""
|
||||
@@ -769,6 +769,10 @@ class TestDocumentSearchApi(DirectoriesMixin, APITestCase):
|
||||
tick=False,
|
||||
):
|
||||
response = self.client.get("/api/documents/?query=added:previous month")
|
||||
assert response.status_code == 200, (
|
||||
f"expected a successful search response, got {response.status_code}: "
|
||||
f"{response.data!r}"
|
||||
)
|
||||
results = response.data["results"]
|
||||
|
||||
self.assertEqual(len(results), 1)
|
||||
|
||||
Reference in New Issue
Block a user