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