File size: 571 Bytes
411a994
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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