ASR-finetuning / tests /test_api.py
saadmannan's picture
HF space application - exclude binary PDFs
5554ef1
raw
history blame contribute delete
927 Bytes
"""
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