api development
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2025-08-08 21:58:36 +09:00
parent d58302c2c8
commit cc87dcc0fa
157 changed files with 14629 additions and 7 deletions

29
scripts/test.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/usr/bin/env bash
# 1) Здоровье сервисов
curl -sS http://localhost:8080/auth/health
curl -sS http://localhost:8080/profiles/health
# 2) Токен (любой юзер)
curl -sS -X POST http://localhost:8080/auth/v1/token \
-H "Content-Type: application/json" \
-d '{"email":"admin@agency.dev","password":"secret123"}' | tee /tmp/token.json
ACCESS=$(python3 - <<'PY' /tmp/token.json
import sys, json; print(json.load(open(sys.argv[1]))["access_token"])
PY
)
# 3) /me — ожидаемо 404 (если профиля нет), главное НЕ 401
curl -i -sS http://localhost:8080/profiles/v1/profiles/me \
-H "Authorization: Bearer $ACCESS"
# 4) Создать профиль — должно быть 201/200, без 500
curl -i -sS -X POST http://localhost:8080/profiles/v1/profiles \
-H "Authorization: Bearer $ACCESS" \
-H "Content-Type: application/json" \
-d '{"gender":"female","city":"Moscow","languages":["ru","en"],"interests":["music","travel"]}'
# 5) Снова /me — теперь 200 с JSON (UUIDы как строки)
curl -sS http://localhost:8080/profiles/v1/profiles/me \
-H "Authorization: Bearer $ACCESS" | jq .