feat: add signed PostgreSQL release updates
This commit is contained in:
+20
-5
@@ -5,12 +5,28 @@
|
||||
set -uo pipefail
|
||||
B="${OA:-http://localhost:8090}/api/oa"
|
||||
TMP=$(mktemp -d)
|
||||
trap 'rm -rf "$TMP"' EXIT
|
||||
pass=0; fail=0; total=0
|
||||
TOKEN=""
|
||||
J(){ python3 -c "import json,sys;d=json.load(open('$1'));print(eval(sys.argv[1]))" "$2" 2>/dev/null; }
|
||||
chk(){ total=$((total+1)); if [ "$2" = "$3" ]; then pass=$((pass+1)); printf " ok %-46s %s\n" "$1" "$3"; else fail=$((fail+1)); printf " XX %-46s got=%s want=%s\n" "$1" "$2" "$3"; fi; }
|
||||
chkge(){ total=$((total+1)); if [ "${2:-0}" -ge "$3" ] 2>/dev/null; then pass=$((pass+1)); printf " ok %-46s >=%s (=%s)\n" "$1" "$3" "$2"; else fail=$((fail+1)); printf " XX %-46s got=%s want>=%s\n" "$1" "$2" "$3"; fi; }
|
||||
GET(){ curl -s -o "$TMP/r.json" -w "%{http_code}" "$B/$1"; }
|
||||
POST(){ curl -s -o "$TMP/r.json" -w "%{http_code}" -X POST "$B/$1" -H 'Content-Type: application/json' -d "$2"; }
|
||||
GET(){
|
||||
if [ -n "$TOKEN" ]; then
|
||||
curl -sS -H "Authorization: Bearer $TOKEN" -o "$TMP/r.json" -w "%{http_code}" "$B/$1"
|
||||
else
|
||||
curl -sS -o "$TMP/r.json" -w "%{http_code}" "$B/$1"
|
||||
fi
|
||||
}
|
||||
POST(){
|
||||
if [ -n "$TOKEN" ]; then
|
||||
curl -sS -H "Authorization: Bearer $TOKEN" -o "$TMP/r.json" -w "%{http_code}" \
|
||||
-X POST "$B/$1" -H 'Content-Type: application/json' -d "$2"
|
||||
else
|
||||
curl -sS -o "$TMP/r.json" -w "%{http_code}" \
|
||||
-X POST "$B/$1" -H 'Content-Type: application/json' -d "$2"
|
||||
fi
|
||||
}
|
||||
|
||||
echo "== AUTH =="
|
||||
code=$(POST auth/login '{"loginName":"admin","password":"123456"}'); chk "login admin valid" "$(J $TMP/r.json "d['code']")" 0
|
||||
@@ -19,7 +35,7 @@ code=$(POST auth/login '{"loginName":"admin","password":"wrong"}'); chk "login w
|
||||
code=$(POST auth/login '{"loginName":"ghost","password":"x"}'); chk "login unknown user -> code!=0" "$(J $TMP/r.json "1 if d['code']!=0 else 0")" 1
|
||||
|
||||
echo "== READ ENDPOINTS (all should code=0) =="
|
||||
for ep in "health" "form-templates" "form-templates?category=财务审批" "tasks?type=todo" "tasks?type=done" "tasks?type=sent" "tasks?type=draft" "meetings" "meeting-rooms" "minutes" "schedule-events" "announcements" "announcements?category=公告" "folders/tree" "documents" "users" "depts/tree" "roles"; do
|
||||
for ep in "health" "form-templates" "form-templates?category=%E8%B4%A2%E5%8A%A1%E5%AE%A1%E6%89%B9" "tasks?type=todo" "tasks?type=done" "tasks?type=sent" "tasks?type=draft" "meetings" "meeting-rooms" "minutes" "schedule-events" "announcements" "announcements?category=%E5%85%AC%E5%91%8A" "folders/tree" "documents" "users" "depts/tree" "roles"; do
|
||||
GET "$ep" >/dev/null; chk "GET $ep" "$(J $TMP/r.json "d['code']")" 0
|
||||
done
|
||||
|
||||
@@ -61,12 +77,11 @@ POST "form-instances/$DID/send" '' >/dev/null; chk "send draft -> 待办" "$(J $
|
||||
POST "form-instances/$DID/send" '' >/dev/null; chk "re-send -> 400" "$(J $TMP/r.json "d['code']")" 400
|
||||
|
||||
echo "== WRITE: meeting / schedule / announcement create =="
|
||||
POST "meetings" '{"subject":"itest会议","startTime":"2026-07-01T02:00:00Z","endTime":"2026-07-01T03:00:00Z","roomId":1,"organizer":"itest","status":"已预定"}' >/dev/null; chk "createMeeting code=0" "$(J $TMP/r.json "d['code']")" 0
|
||||
POST "meetings" '{"subject":"itest会议","startTime":"2026-07-01T02:00:00Z","endTime":"2026-07-01T03:00:00Z","organizer":"itest","status":"已预定"}' >/dev/null; chk "createMeeting code=0" "$(J $TMP/r.json "d['code']")" 0
|
||||
POST "schedule-events" '{"title":"itest事件","type":"会议","startTime":"2026-07-01T02:00:00Z","endTime":"2026-07-01T03:00:00Z","owner":"itest"}' >/dev/null; chk "createEvent code=0" "$(J $TMP/r.json "d['code']")" 0
|
||||
POST "announcements" '{"category":"公告","title":"itest公告","content":"x","author":"itest","top":false}' >/dev/null; chk "createAnnouncement code=0" "$(J $TMP/r.json "d['code']")" 0
|
||||
POST "form-templates" '{"name":"itest模板","category":"测试","org":"信息中心","form":{"title":"t","rows":[]},"flow":{"nodes":[],"edges":[]}}' >/dev/null; chk "createTemplate code=0" "$(J $TMP/r.json "d['code']")" 0
|
||||
|
||||
rm -rf "$TMP"
|
||||
echo
|
||||
pct=$(python3 -c "print(round($pass/$total*100,1))")
|
||||
printf "RESULT: %d/%d passed (%.1f%%), %d failed\n" "$pass" "$total" "$pct" "$fail"
|
||||
|
||||
Reference in New Issue
Block a user