python_env / tests /test_api.py
uvpatel7271's picture
Upload folder using huggingface_hub
c8e832f verified
raw
history blame contribute delete
835 Bytes
from fastapi.testclient import TestClient
from server.app import app
client = TestClient(app)
def test_health_endpoint():
response = client.get("/health")
assert response.status_code == 200
payload = response.json()
assert payload["status"] == "ok"
assert payload["environment"] == "python_code_review_env"
def test_reset_returns_expected_observation():
response = client.post("/reset", json={"task_id": "syntax-fix-easy"})
assert response.status_code == 200
payload = response.json()
assert payload["observation"]["task_id"] == "syntax-fix-easy"
assert "current_code" in payload["observation"]
def test_tasks_endpoint_lists_three_tasks():
response = client.get("/tasks")
assert response.status_code == 200
assert len(response.json()) == 3