Spaces:
Sleeping
Sleeping
Update tests/test_health.py
Browse files- tests/test_health.py +15 -10
tests/test_health.py
CHANGED
|
@@ -1,10 +1,15 @@
|
|
| 1 |
-
from fastapi.testclient import TestClient
|
| 2 |
-
from
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi.testclient import TestClient
|
| 2 |
+
from unittest.mock import patch
|
| 3 |
+
from main import app
|
| 4 |
+
|
| 5 |
+
client = TestClient(app)
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
def test_root_health():
|
| 9 |
+
with patch("app.services.prediction.is_model_available", return_value=True):
|
| 10 |
+
resp = client.get("/")
|
| 11 |
+
|
| 12 |
+
assert resp.status_code == 200
|
| 13 |
+
body = resp.json()
|
| 14 |
+
assert "status" in body
|
| 15 |
+
assert "modelLoaded" in body
|