File size: 840 Bytes
1395b2e | 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 | from fastapi.testclient import TestClient
from app import app
def test_health_and_reset_flow():
client = TestClient(app)
health = client.get('/health')
assert health.status_code == 200
assert health.json()['status'] == 'ok'
reset = client.post('/reset', json={'task_id': 'easy_password_reset'})
assert reset.status_code == 200
payload = reset.json()
assert payload['task_id'] == 'easy_password_reset'
assert payload['step_count'] == 0
step = client.post('/step', json={'action_type': 'read_ticket', 'ticket_id': 'T-1001'})
assert step.status_code == 200
body = step.json()
assert body['done'] is False
assert body['observation']['step_count'] == 1
state = client.get('/state')
assert state.status_code == 200
assert state.json()['task_id'] == 'easy_password_reset'
|