File size: 1,026 Bytes
0cb452d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""Test HTTP endpoints against running server."""
import httpx

BASE = "http://127.0.0.1:8000"

# Health
r = httpx.get(f"{BASE}/health")
print(f"Health: {r.status_code} {r.text}")

# Reset with empty body (required for pre-submission validator)
r = httpx.post(f"{BASE}/reset", json={})
print(f"Reset (empty): {r.status_code}")

# Reset with task_name
r = httpx.post(f"{BASE}/reset", json={"task_name": "basic-triage"})
data = r.json()
obs = data.get("observation", data)
pid = obs.get("current_patient", {}).get("patient_id", "?")
print(f"Reset (basic-triage): {r.status_code}, patient={pid}")

# Step
r = httpx.post(f"{BASE}/step", json={
    "action_type": "assign_priority",
    "patient_id": "P001",
    "priority_level": "immediate"
})
data = r.json()
print(f"Step: {r.status_code}, reward={data.get('reward', '?')}, done={data.get('done', '?')}")

# State
r = httpx.get(f"{BASE}/state")
state = r.json()
print(f"State: {r.status_code}, assignments={state.get('assignments', {})}")

print("\nALL ENDPOINT TESTS PASSED!")