- Update conftest for lazy agent initialization - Update chat router tests for Tatlock capabilities - Update models router tests for tools capability - Update responses advanced features tests - Update main app tests - Total: 131 tests, 81.78% coverage (up from 95 tests, 78.95%)
49 lines
1.3 KiB
Python
49 lines
1.3 KiB
Python
"""
|
|
Tests for models listing router.
|
|
"""
|
|
import pytest
|
|
from fastapi.testclient import TestClient
|
|
|
|
|
|
@pytest.mark.unit
|
|
def test_list_models(client: TestClient) -> None:
|
|
"""Test listing available models."""
|
|
response = client.get("/v1/models")
|
|
|
|
assert response.status_code == 200
|
|
data = response.json()
|
|
|
|
# Verify response structure
|
|
assert data["object"] == "list"
|
|
assert "data" in data
|
|
assert isinstance(data["data"], list)
|
|
|
|
# Should have both models from registry
|
|
assert len(data["data"]) == 2
|
|
|
|
# Check for expected model IDs
|
|
model_ids = [m["id"] for m in data["data"]]
|
|
assert "lorem-tester" in model_ids
|
|
assert "Tatlock" in model_ids
|
|
|
|
# Verify model structure
|
|
for model in data["data"]:
|
|
assert model["object"] == "model"
|
|
assert "id" in model
|
|
assert "created" in model
|
|
assert "owned_by" in model
|
|
assert model["owned_by"] == "tatlock"
|
|
|
|
|
|
@pytest.mark.unit
|
|
def test_models_endpoint_returns_json(client: TestClient) -> None:
|
|
"""Test that models endpoint returns valid JSON."""
|
|
response = client.get("/v1/models")
|
|
|
|
assert response.status_code == 200
|
|
assert response.headers["content-type"] == "application/json"
|
|
|
|
# Should be able to parse as JSON
|
|
data = response.json()
|
|
assert isinstance(data, dict)
|