autocodefix-ai / tests /test_api.py
hmnshudhmn24's picture
Upload 35 files
67f450b verified
from fastapi.testclient import TestClient
from src.app.main import app
client = TestClient(app)
def test_root():
r = client.get('/')
assert r.status_code == 200
def test_repair_endpoint():
payload = {"buggy": "def add(a, b)\n return a + b"}
r = client.post('/repair', json=payload)
assert r.status_code == 200
data = r.json()
assert 'fixed' in data and 'explanation' in data