20 lines
1.0 KiB
Bash
20 lines
1.0 KiB
Bash
#!/bin/sh
|
|
# E2E: зоны после фикса forest_pct — ранжирование без систематического перекоса
|
|
set -e
|
|
TOKEN=$(curl -s -m 8 -X POST localhost:8000/api/v1/auth/login \
|
|
-H 'Content-Type: application/x-www-form-urlencoded' \
|
|
--data 'username=admin&password=pass123' \
|
|
| python3 -c 'import sys,json; print(json.load(sys.stdin)["access_token"])')
|
|
curl -s -m 60 -X POST localhost:8000/api/v1/analyze \
|
|
-H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
|
|
-d '{"age": 8, "gender": "м", "terrain": ["лес"], "elapsed_hours": 2.0, "has_transport": "bike", "season": "лето", "lat": 53.9, "lon": 27.56}' \
|
|
> /tmp/analyze-forestfix.json
|
|
python3 - <<'PY'
|
|
import json
|
|
d = json.load(open('/tmp/analyze-forestfix.json'))
|
|
print('Зоны (priority → direction):')
|
|
for z in d['primary_zones']:
|
|
print(f" #{z['priority']} {z['direction']:3s} {z['distance']}км — {z['name']}")
|
|
assert 'detail' not in d
|
|
print('OK: анализ не упал, зоны проранжированы')
|
|
PY |