| 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' | |