diff options
author | Torsten Grote <t@grobox.de> | 2020-05-07 15:33:43 -0300 |
---|---|---|
committer | Torsten Grote <t@grobox.de> | 2020-05-07 15:33:43 -0300 |
commit | 38601a1c63840bc85eae166f771a974e0629db28 (patch) | |
tree | 1cba1f2300e4b752ffd8726d9d4b3bf1cd0d61ea /integrationtests/test-double-spend.sh | |
parent | b7c75bd56a484efcf77210f1541cda67e2a90f61 (diff) | |
download | wallet-core-38601a1c63840bc85eae166f771a974e0629db28.tar.xz |
Add test for double spending (still fails as expected)
Diffstat (limited to 'integrationtests/test-double-spend.sh')
-rwxr-xr-x | integrationtests/test-double-spend.sh | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/integrationtests/test-double-spend.sh b/integrationtests/test-double-spend.sh new file mode 100755 index 000000000..ee2a966f7 --- /dev/null +++ b/integrationtests/test-double-spend.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# Script to check that the wallet can not double spend coins and handles this error well + +source "common.sh" +setup_config "double-spend" +setup_services +launch_services +wait_for_services + +echo "Withdraw TESTKUDOS" +taler-wallet-cli --wallet-db="$WALLET_DB" --no-throttle testing withdraw -e "$EXCHANGE_URL" -b "$BANK_URL" -a "TESTKUDOS:10" >/dev/null +# Copy wallet database before spending coins +cp "$WALLET_DB" "$WALLET_DB.bak" +echo "Spend all the money" +taler-wallet-cli --wallet-db="$WALLET_DB" testing test-pay -m "$MERCHANT_URL" -k sandbox -a "TESTKUDOS:9.5" -s "foo" +echo "New balance:" +taler-wallet-cli --wallet-db="$WALLET_DB" balance +# Restore old wallet database +mv "$WALLET_DB.bak" "$WALLET_DB" +echo "Balance after getting old coins back:" +taler-wallet-cli --wallet-db="$WALLET_DB" balance +echo "Try to double-spend" +# TODO this should probably fail more gracefully +# "exchange_reply: { hint: 'insufficient funds', code: 1200 } +taler-wallet-cli --wallet-db="$WALLET_DB" testing test-pay -m "$MERCHANT_URL" -k sandbox -a "TESTKUDOS:9.5" -s "foo" + +echo "SUCCESS" +exit 0 |