ameliakris's picture
Initial commit
0e4080b
import pytest
from fastapi.testclient import TestClient
from app import app
client = TestClient(app)
def test_chat_endpoint():
test_messages = [
{"role": "user", "content": "What is 2+2?"}
]
response = client.post(
"/api/chat",
json={
"messages": test_messages,
"use_gemini": False, # Test local LLM
"temperature": 0.7
}
)
assert response.status_code == 200
assert "response" in response.json()
assert isinstance(response.json()["response"], str)
def test_gemini_chat():
test_messages = [
{"role": "user", "content": "Tell me a short joke."}
]
response = client.post(
"/api/chat",
json={
"messages": test_messages,
"use_gemini": True, # Test Gemini API
"temperature": 0.7
}
)
assert response.status_code == 200
assert "response" in response.json()
assert isinstance(response.json()["response"], str)