forked from innovacion/searchbox
Rewrite tests while keeping 97% cov
This commit is contained in:
33
tests/test_mcp/test_qdrant_mcp.py
Normal file
33
tests/test_mcp/test_qdrant_mcp.py
Normal 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"}
|
||||
Reference in New Issue
Block a user