medilang-tech / tests /test_live_ai.py
Dama03's picture
first push of the AI
411a994
raw
history blame contribute delete
571 Bytes
import os
import pytest
from fastapi.testclient import TestClient
from main import app
requires_live = pytest.mark.skipif(
not os.getenv("OPENAI_API_KEY"), reason="Skipping live AI tests: OPENAI_API_KEY not set"
)
@requires_live
def test_unified_text_live():
client = TestClient(app)
r = client.post("/api/chat/unified", json={
"message": "J'ai de la fièvre et des frissons",
"message_type": "text",
"language": "fr"
})
assert r.status_code == 200
data = r.json()
assert "response" in data and "context" in data