This commit is contained in:
29
scripts/test.sh
Executable file
29
scripts/test.sh
Executable 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 .
|
||||
Reference in New Issue
Block a user