Spaces:
Sleeping
Sleeping
File size: 1,117 Bytes
fba078d | 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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | """Tests for app-specific helper endpoints."""
from fastapi.testclient import TestClient
from openenv_bug_triage.app import app
from openenv_bug_triage.models import ActionModel
client = TestClient(app)
def test_baseline_endpoint_returns_summary():
response = client.get("/baseline")
assert response.status_code == 200
payload = response.json()
assert "mean_score" in payload
assert isinstance(payload.get("results"), list)
def test_suggest_action_returns_typed_action_for_active_ticket():
reset_response = client.post("/reset", json={"task_id": "bug_triage_easy", "seed": 42})
assert reset_response.status_code == 200
response = client.get("/suggest_action")
assert response.status_code == 200
payload = response.json()
assert "reason" in payload
assert isinstance(payload.get("history"), list)
action = ActionModel(**payload["action"])
assert action.action_type in {
"classify",
"assign",
"mark_duplicate",
"request_info",
"defer",
"close",
"escalate_incident",
"next_ticket",
}
|