Spaces:
Sleeping
Sleeping
File size: 927 Bytes
5554ef1 |
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 |
"""
Unit tests for FastAPI endpoints
"""
import pytest
from fastapi.testclient import TestClient
from api.main import app
client = TestClient(app)
def test_root_endpoint():
"""Test root endpoint"""
response = client.get("/")
assert response.status_code == 200
data = response.json()
assert "message" in data
assert "version" in data
assert "endpoints" in data
def test_health_endpoint():
"""Test health check endpoint"""
response = client.get("/health")
assert response.status_code == 200
data = response.json()
assert "status" in data
assert "model_loaded" in data
assert "device" in data
def test_transcribe_no_file():
"""Test transcribe endpoint without file"""
response = client.post("/transcribe")
assert response.status_code == 422 # Unprocessable Entity
# Add more tests as needed
# Note: Full transcription tests require model to be loaded
|