From 42d59570ebb81cde802ac22007c15cbe90b281d1 Mon Sep 17 00:00:00 2001 From: Sanket Raj Date: Fri, 23 Jan 2026 00:48:13 +0530 Subject: [PATCH] Add files via upload --- test_main.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 test_main.py diff --git a/test_main.py b/test_main.py new file mode 100644 index 0000000..de720cb --- /dev/null +++ b/test_main.py @@ -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() \ No newline at end of file