Download tests/test_api.py from afroimam/meta_hackathon: direct link, hf CLI and curl.
- Browser
- Download file 840 Bytes
-
https://huggingface.co/afroimam/meta_hackathon/resolve/main/tests/test_api.py
- Command line
-
hf download hf://afroimam/meta_hackathon/tests/test_api.py
-
curl -L -o test_api.py https://huggingface.co/afroimam/meta_hackathon/resolve/main/tests/test_api.py
840 Bytes
| 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' | |