Rewrite tests while keeping 97% cov

This commit is contained in:
2025-09-27 16:26:03 +00:00
parent cf7e3d8244
commit 51606fc959
23 changed files with 180 additions and 2968 deletions

View File

@@ -0,0 +1,33 @@
import json
import pytest
from fastmcp import Client
from fastembed import TextEmbedding
from searchbox.mcp_server.server import mcp
embedding_model = TextEmbedding()
@pytest.fixture
async def mcp_client():
async with Client(mcp) as client:
yield client
async def test_mcp_qdrant_backend(mcp_client):
embedding = list(embedding_model.embed("Quien es el mas guapo"))[0].tolist()
result = await mcp_client.call_tool(
name="get_information",
arguments={
"query": "dummy value",
"collection": "dummy_collection",
"embedding": embedding,
},
)
content = json.loads(result.content[0].text)[0]
assert content["chunk_id"] == "0"
assert content["score"] >= 0.7
assert content["payload"] == {"text": "Rick es el mas guapo"}