25 lines
765 B
Bash
Executable File
25 lines
765 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
BASE="${BASE_URL:-http://localhost:8000/import/wiki}"
|
|
|
|
# 1) Health-Check
|
|
echo "? Health-Check…"
|
|
curl -s -o /dev/null -w '%{http_code}\n' "${BASE}/health"
|
|
|
|
# 2) Login (damit Session-Cookies gesetzt werden, wenn Du das weiter nutzt)
|
|
echo -e "\n? Login…"
|
|
curl -s -X POST "${BASE}/login" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"username\":\"${WIKI_BOT_USER}\",\"password\":\"${WIKI_BOT_PASSWORD}\"}" | jq
|
|
|
|
# 3) Import aus Kategorie
|
|
echo -e "\n? Importiere Übungen aus „Übungen“…"
|
|
RESP=$(curl -s -G "${BASE}/import/exercises" \
|
|
--data-urlencode "category=Übungen")
|
|
echo "$RESP" | jq
|
|
|
|
# 4) Ergebnis prüfen
|
|
IMPORTED=$(echo "$RESP" | jq '.imported | length')
|
|
echo -e "\n? Anzahl importierter Übungen: $IMPORTED"
|