Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions test_main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from fastapi.testclient import TestClient
from app.main import app

client = TestClient(app)

def test_health_check():
"""Ensure the app can start and expose metrics"""
response = client.get("/metrics")
assert response.status_code == 200

def test_prediction_flow():
"""Ensure the model inference endpoint accepts valid JSON"""
response = client.post(
"/predict",
json={"text": "Hello world"}
)
assert response.status_code == 200
assert "generated_text" in response.json()