commit e753bf256002db847a69bbcf951991fcfc6d932d parent b066127343e62a96c965db88911cc7af3ac9fb31 Author: Christian Grothoff <grothoff@gnunet.org> Date: Mon, 26 Jan 2026 08:20:11 +0100 add test for #9973 Diffstat:
| M | src/testing/test_merchant_statistics.sh | | | 31 | ++++++++++++++++++++++++++++++- |
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/src/testing/test_merchant_statistics.sh b/src/testing/test_merchant_statistics.sh @@ -114,7 +114,22 @@ then else FORTYTHREE=$(get_payto_uri fortythree x) fi -# create with 2 bank account addresses + +# add bank account +STATUS=$(curl -H "Content-Type: application/json" -X POST \ + -H 'Authorization: Bearer secret-token:super_secret' \ + http://localhost:9966/private/accounts \ + -d '{"payto_uri":"'"$FORTYTHREE"'"}' \ + -w "%{http_code}" -s -o /dev/null) + +if [ "$STATUS" != "200" ] +then + exit_fail "Expected '200 OK' response. Got instead $STATUS" +fi +echo "OK" + +echo -n "Adding same account again ..." +# add same bank account again (check idempotency) STATUS=$(curl -H "Content-Type: application/json" -X POST \ -H 'Authorization: Bearer secret-token:super_secret' \ http://localhost:9966/private/accounts \ @@ -125,6 +140,20 @@ if [ "$STATUS" != "200" ] then exit_fail "Expected '200 OK' response. Got instead $STATUS" fi +echo "OK" + +echo -n "Checking idempotency ..." +curl -H "Content-Type: application/json" \ + -H 'Authorization: Bearer secret-token:super_secret' \ + http://localhost:9966/private/accounts > "$LAST_RESPONSE" 2> /dev/null +NUM=$(jq '.accounts|length' < "$LAST_RESPONSE") + +if [ "$NUM" != "1" ] +then + cat "$LAST_RESPONSE" >&2 + exit_fail "Expected 1 account. got: $NUM" +fi +echo " OK" echo -n "Creating order with non-existing POT..."