File size: 1,475 Bytes
8c0b652
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
"""
Basic API endpoint tests
"""
import pytest
import requests
from typing import Dict, Any


class TestAPIEndpoints:
    """Test basic API functionality"""
    
    @pytest.fixture
    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