test(vector): use network-mode 404 signal + https in not-wrap test (#926)

- Clear SonarCloud hotspot python:S5332 (insecure http:// URL) by using
  https:// for the inert placeholder Qdrant URL in the network-mode test.
- Make the test faithful to production: stub the network existence-check
  with UnexpectedResponse(404) (what the real HTTP client raises) instead
  of the local-mode ValueError("not found"), per round-2 review.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Chris Coutinho
2026-06-19 10:22:39 +02:00
co-authored by Claude Opus 4.8
parent de960715c6
commit 5b468514ec
+6 -4
View File
@@ -1134,7 +1134,7 @@ async def test_get_qdrant_client_does_not_wrap_network_mode(
from nextcloud_mcp_server.config import Settings
settings = Settings(
qdrant_url="http://qdrant:6333",
qdrant_url="https://qdrant:6333",
ollama_embedding_model="nomic-embed-text",
vector_sync_enabled=False,
)
@@ -1149,10 +1149,12 @@ async def test_get_qdrant_client_does_not_wrap_network_mode(
lambda: embedding_service,
)
# Drive the create path (collection "not found") so the dimension-validation
# branch — which would need a fully-shaped CollectionInfo — is skipped.
# Drive the create path via the network-mode "not found" signal — an
# UnexpectedResponse(404), as the real HTTP client raises (local mode's
# ValueError("not found") is the other branch). This skips the
# dimension-validation branch that would need a fully-shaped CollectionInfo.
provisional = _stub_provisional(
mocker, ValueError(f"Collection {settings.get_collection_name()} not found")
mocker, _make_unexpected(404, b'{"status":{"error":"Not found"}}')
)
monkeypatch.setattr(
"nextcloud_mcp_server.vector.qdrant_client.AsyncQdrantClient",