managarten/services/mana-llm/tests/test_api.py
Till-JS 1495dbe476 feat(mana-llm): add central LLM abstraction service
Python/FastAPI service providing unified OpenAI-compatible API for
Ollama and cloud LLM providers (OpenRouter, Groq, Together).

Features:
- Chat completions with streaming (SSE)
- Vision/multimodal support
- Embeddings generation
- Multi-provider routing (provider/model format)
- Prometheus metrics
- Optional Redis caching
2026-01-29 22:01:00 +01:00

41 lines
1 KiB
Python

"""API endpoint tests."""
import pytest
from fastapi.testclient import TestClient
@pytest.fixture
def client():
"""Create test client."""
from src.main import app
with TestClient(app) as c:
yield c
def test_health_endpoint(client):
"""Test health check endpoint."""
response = client.get("/health")
assert response.status_code == 200
data = response.json()
assert "status" in data
assert "service" in data
assert data["service"] == "mana-llm"
def test_metrics_endpoint(client):
"""Test metrics endpoint."""
response = client.get("/metrics")
assert response.status_code == 200
assert "mana_llm" in response.text
def test_list_models_endpoint(client):
"""Test list models endpoint."""
response = client.get("/v1/models")
# May fail if Ollama is not running, but should return valid response structure
if response.status_code == 200:
data = response.json()
assert "data" in data
assert "object" in data
assert data["object"] == "list"