From e9c51bcfb25a486289570c945dcbb70afe0a2c7a Mon Sep 17 00:00:00 2001 From: viktot14-ai Date: Wed, 9 Sep 2026 19:18:49 +0300 Subject: [PATCH] =?UTF-8?q?scripts:=20e2e=20=D0=B3=D0=B5=D0=BE=D0=BA=D0=BE?= =?UTF-8?q?=D0=B4=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20+=20?= =?UTF-8?q?=D0=B1=D0=B0=D0=B3=D1=84=D0=B8=D0=BA=D1=81=D0=B0=20lost=5Ftime?= =?UTF-8?q?=E2=86=92loss=5Ftime?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/e2e-geocode.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 scripts/e2e-geocode.sh diff --git a/scripts/e2e-geocode.sh b/scripts/e2e-geocode.sh new file mode 100644 index 0000000..1d94cc3 --- /dev/null +++ b/scripts/e2e-geocode.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# E2E: геокодирование на живом ВЕКТОРЕ +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"])') +echo "=== geocode «Минск, Ленина 10»:" +curl -s -m 15 "localhost:8000/api/v1/geocode?q=%D0%9C%D0%B8%D0%BD%D1%81%D0%BA%2C%20%D0%9B%D0%B5%D0%BD%D0%B8%D0%BD%D0%B0%2010&limit=2" \ + -H "Authorization: Bearer $TOKEN" | python3 -m json.tool | head -16 +echo "=== без токена — должен быть 401/403:" +curl -s -o /dev/null -w "%{http_code}\n" -m 15 "localhost:8000/api/v1/geocode?q=test" +echo "=== потерянное время: карточка c lost_time сохраняет loss_time:" +curl -s -m 15 -X POST localhost:8000/api/v1/cases \ + -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \ + -d '{"age_years": 8, "gender": "м", "lost_time": "2026-09-09T12:00:00", "last_known_place": "Минск, Ленина 10", "elapsed_hours": 3.5, "tnp_lat": 53.9, "tnp_lon": 27.56}' > /tmp/case-created.json +python3 - <<'PY' +import json +d = json.load(open('/tmp/case-created.json')) +cid = d.get('id') +print('case created:', cid) +assert cid +open('/tmp/case-id.txt', 'w').write(cid) +PY +CID=$(cat /tmp/case-id.txt) +curl -s -m 15 "localhost:8000/api/v1/cases/$CID" -H "Authorization: Bearer $TOKEN" | python3 -c ' +import json, sys +d = json.load(sys.stdin) +lt = d.get("loss_time") or (d.get("result") or {}).get("loss_time") +detail = d if "loss_time" in d else d +print("loss_time сохранён:", lt) +assert lt, "loss_time ПУСТОЙ — алиас не сработал!" +print("LOST_TIME BUGFIX OK")' \ No newline at end of file