Spaces:
Running
Running
File size: 773 Bytes
646ab82 0214972 646ab82 0214972 646ab82 0214972 646ab82 0214972 646ab82 0214972 646ab82 | 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 27 28 29 | import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
os.environ["SKIP_MODEL_LOAD"] = "true"
import pytest
from fastapi.testclient import TestClient
from api.main import app
client = TestClient(app)
def test_health():
response = client.get("/health")
assert response.status_code == 200
assert response.json()["status"] == "ok"
def test_query_too_short():
response = client.post("/query", json={"query": "hi"})
assert response.status_code == 400
def test_query_too_long():
response = client.post("/query", json={"query": "a" * 2001})
assert response.status_code == 400
def test_query_empty():
response = client.post("/query", json={"query": ""})
assert response.status_code == 400 |