Spaces:
Runtime error
Runtime error
| """ | |
| Basic API endpoint tests | |
| """ | |
| import pytest | |
| import requests | |
| from typing import Dict, Any | |
| class TestAPIEndpoints: | |
| """Test basic API functionality""" | |
| def base_url(self): | |
| return "http://localhost:8000" | |
| def test_health_endpoint(self, base_url): | |
| """Test health check endpoint""" | |
| response = requests.get(f"{base_url}/health") | |
| assert response.status_code == 200 | |
| data = response.json() | |
| assert "status" in data | |
| assert data["status"] == "healthy" | |
| def test_models_endpoint(self, base_url): | |
| """Test models listing endpoint""" | |
| response = requests.get(f"{base_url}/models") | |
| assert response.status_code == 200 | |
| data = response.json() | |
| assert "models" in data | |
| assert isinstance(data["models"], list) | |
| def test_openai_models_endpoint(self, base_url): | |
| """Test OpenAI-compatible models endpoint""" | |
| response = requests.get(f"{base_url}/v1/models") | |
| assert response.status_code == 200 | |
| data = response.json() | |
| assert "data" in data | |
| assert isinstance(data["data"], list) | |
| def test_diagnose_imports_endpoint(self, base_url): | |
| """Test import diagnosis endpoint""" | |
| response = requests.get(f"{base_url}/diagnose-imports") | |
| assert response.status_code == 200 | |
| data = response.json() | |
| assert "architecture" in data | |
| assert "imports" in data | |