File size: 650 Bytes
e0b3e8f dae8c75 | 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 | from fastapi.testclient import TestClient
from main import app
client = TestClient(app)
def test_root():
response = client.get("/")
assert response.status_code == 200
assert response.json() == {"message": "Backend is running 🚀"}
def test_health():
response = client.get("/api/health")
assert response.status_code == 200
assert response.json() == {"status": "ok"}
def test_nlp_health():
response = client.get("/api/nlp/health")
assert response.status_code == 200
assert response.json() == {"status": "online"}
print("Running tests...")
test_root()
test_health()
test_nlp_health()
print("All tests passed!")
|