From 9c8b9d7a2057ca7e9661e1c56bec15d8fcfd62fe Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Sun, 18 Oct 2026 23:45:10 -0700 Subject: [PATCH] Dont need em any more --- src/documents/tests/test_api_search.py | 23 ------------- ...ument_list_effective_content_annotation.py | 32 ------------------- 2 files changed, 55 deletions(-) diff --git a/src/documents/tests/test_api_search.py b/src/documents/tests/test_api_search.py index d7a07f5ed..b4ba9df95 100644 --- a/src/documents/tests/test_api_search.py +++ b/src/documents/tests/test_api_search.py @@ -2137,29 +2137,6 @@ class TestDocumentSearchApi(DirectoriesMixin, APITestCase): self.assertEqual(len(response.data["documents"]), 1) self.assertEqual(response.data["documents"][0]["id"], title_match.id) - def test_global_search_returns_latest_version_content(self) -> None: - root = Document.objects.create( - title="bank statement", - content="superseded content", - checksum="GSV1", - pk=23, - ) - Document.objects.create( - title="bank statement v2", - content="latest content", - checksum="GSV2", - pk=24, - root_document=root, - version_index=1, - ) - - self.client.force_authenticate(self.user) - - response = self.client.get("/api/search/?query=bank&db_only=true") - self.assertEqual(response.status_code, status.HTTP_200_OK) - returned = {doc["id"]: doc["content"] for doc in response.data["documents"]} - self.assertEqual(returned.get(root.id), "latest content") - def test_global_search_filters_owned_mail_objects(self) -> None: user1 = UserFactory(username="mail-search-user") user2 = UserFactory(username="other-mail-search-user") diff --git a/src/documents/tests/test_document_list_effective_content_annotation.py b/src/documents/tests/test_document_list_effective_content_annotation.py index 4656bff5f..9a1b0978d 100644 --- a/src/documents/tests/test_document_list_effective_content_annotation.py +++ b/src/documents/tests/test_document_list_effective_content_annotation.py @@ -423,35 +423,3 @@ class TestTrashAndGlobalSearchEffectiveContentIsNeverPerInstance: [result] = [r for r in response.data["results"] if r["id"] == root.id] assert result["content"] == "own-content" assert _get_effective_content_fallback_queries(ctx) == [] - - def test_global_search_db_only_shows_latest_version_content_with_no_extra_query( - self, - admin_client: APIClient, - ) -> None: - """ - GIVEN: - - A root document, findable by title, whose own content differs - from its latest version's - WHEN: - - Using the global search endpoint's db_only mode - THEN: - - The response shows the latest version's content, resolved by - GlobalSearchView's own effective_content annotation - - There is no per-instance fallback query - """ - root = DocumentFactory(title="findme", content="own-content") - DocumentFactory( - root_document=root, - version_index=1, - content="version-content", - ) - - with CaptureQueriesContext(connection) as ctx: - response = admin_client.get( - "/api/search/?query=findme&db_only=true", - ) - - assert response.status_code == status.HTTP_200_OK - [result] = [d for d in response.data["documents"] if d["id"] == root.id] - assert result["content"] == "version-content" - assert _get_effective_content_fallback_queries(ctx) == []