File size: 787 Bytes
673435a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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

from fastapi.testclient import TestClient
from app.core.config import get_settings

settings = get_settings()

def test_health_check(client: TestClient):
    """Test health check endpoint"""
    response = client.get("/health")
    assert response.status_code == 200
    data = response.json()
    assert data["status"] == "healthy"

def test_root(client: TestClient):
    """Test root endpoint redirects or 404"""
    response = client.get("/")
    # Check if root is handled, usually 404 in API only app or redirect
    assert response.status_code in [200, 404]

def test_openapi_docs(client: TestClient):
    """Test that Swagger UI is accessible"""
    response = client.get("/docs")
    assert response.status_code == 200
    assert "text/html" in response.headers["content-type"]