1# Invite posts are counted per address, and only those with a live invite's2# code: 10 a minute, then a 429. Junk codes, however many, are never3# counted, so they can't use up an invitee's turns, and another address4# has its own count.5. "$(dirname "$0")/../lib.sh"6user cat7export FORGE_BASE_URL=https://forge.test8private_server9ok forge user invite fox10code=$(sed -n 's/^ .*#invite=//p' "$T_LOG")11ask() { http -s -o /dev/null -w '%{http_code}' -H 'Origin: https://forge.test' -H 'Content-Type: application/json' -H "X-Forge-Client-IP: $1" -d "{\"code\":\"$2\"}" "$PRIV/login/invite/options"; }12n=013while [ "$n" -lt 40 ]; do14 eq "$(ask 192.0.2.9 "junk$n")" 40015 n=$((n + 1))16done17n=018while [ "$n" -lt 10 ]; do19 eq "$(ask 192.0.2.9 "$code")" 20020 n=$((n + 1))21done22eq "$(ask 192.0.2.9 "$code")" 42923eq "$(ask 192.0.2.9 junk)" 40024eq "$(ask 192.0.2.10 "$code")" 200