Files
kv-ai/tests/test_api.py

32 lines
854 B
Python

"""Simple smoke tests for FastAPI backend."""
import pytest
def test_api_imports():
"""Test that API module imports correctly."""
# This will fail if there are any import errors
from companion.api import app, ChatRequest
assert app is not None
assert ChatRequest is not None
def test_chat_request_model():
"""Test ChatRequest model validation."""
from companion.api import ChatRequest
# Valid request
req = ChatRequest(message="hello", session_id="abc123")
assert req.message == "hello"
assert req.session_id == "abc123"
# Valid request with temperature
req2 = ChatRequest(message="hello", temperature=0.7)
assert req2.temperature == 0.7
# Valid request with minimal fields
req3 = ChatRequest(message="hello")
assert req3.session_id is None
assert req3.temperature is None