Files
fckbot/tests/integration/test_endpoints.py
2026-06-30 21:06:47 +00:00

21 lines
805 B
Python

"""
Интеграционные тесты для новых эндпоинтов RAG-сервера.
"""
import pytest
import httpx
from unittest.mock import AsyncMock, patch
@pytest.mark.asyncio
async def test_clear_endpoint():
async with httpx.AsyncClient() as client:
with patch("rag.rag_server.get_orchestrator") as mock_orch:
mock_orch.return_value.clear_kb = AsyncMock(return_value={"status": "ok"})
response = await client.post(
"http://localhost:8080/rag/clear",
json={"user_jid": "test@domain", "room_jid": None, "is_global": False},
headers={"X-API-Key": "testkey"}
)
assert response.status_code == 200
data = response.json()
assert data.get("status") == "ok"