aboutsummaryrefslogtreecommitdiff
path: root/integrationtests/test-refund.sh
diff options
context:
space:
mode:
authorTorsten Grote <t@grobox.de>2020-05-08 15:02:07 -0300
committerTorsten Grote <t@grobox.de>2020-05-08 15:02:07 -0300
commit7e947ca2cdd8e66ea49822acbad81e7d35289c0a (patch)
treedb9240c5c67d69d89785110c4f2bf346a87d2622 /integrationtests/test-refund.sh
parent1cf48054c47d9562876b5f021dc398b050b959fd (diff)
downloadwallet-core-7e947ca2cdd8e66ea49822acbad81e7d35289c0a.tar.xz
Add functions for getting and comparing balances to integration tests
Diffstat (limited to 'integrationtests/test-refund.sh')
-rwxr-xr-xintegrationtests/test-refund.sh13
1 files changed, 8 insertions, 5 deletions
diff --git a/integrationtests/test-refund.sh b/integrationtests/test-refund.sh
index d4193dbb7..7b8fbdef7 100755
--- a/integrationtests/test-refund.sh
+++ b/integrationtests/test-refund.sh
@@ -6,18 +6,21 @@ normal_start_and_wait "refund"
echo "Withdraw TESTKUDOS"
taler-wallet-cli --wallet-db="$WALLET_DB" --no-throttle testing withdraw -e "$EXCHANGE_URL" -b "$BANK_URL" -a "TESTKUDOS:10" >>"$LOG" 2>>"$LOG"
-echo -n "Balance after withdrawal: "
-taler-wallet-cli --wallet-db="$WALLET_DB" balance 2>>"$LOG"
+BALANCE_1=$(get_balance)
+echo "Balance after withdrawal: $BALANCE_1"
REFUND_URI=$(taler-wallet-cli --wallet-db="$WALLET_DB" --no-throttle testing gen-refund-uri \
-m "$MERCHANT_URL" -k sandbox \
-s "first refund" -a "TESTKUDOS:8" -r "TESTKUDOS:2" 2>>"$LOG" | grep -E -m 1 -o "taler://refund.*insecure=1")
-echo -n "Balance after payment: "
+BALANCE_2=$(get_balance)
+echo "Balance after payment: $BALANCE_2"
+assert_less_than "$BALANCE_2" "$BALANCE_1"
taler-wallet-cli --wallet-db="$WALLET_DB" balance 2>>"$LOG"
echo "Handling refund: $REFUND_URI"
taler-wallet-cli --wallet-db="$WALLET_DB" --no-throttle handle-uri "$REFUND_URI" 2>"$LOG"
taler-wallet-cli --wallet-db="$WALLET_DB" run-until-done 2>>"$LOG" >>"$LOG"
-echo -n "Balance after first refund: "
-taler-wallet-cli --wallet-db="$WALLET_DB" balance 2>>"$LOG"
+BALANCE_3=$(get_balance)
+echo "Balance after first refund: $BALANCE_3"
+assert_greater_than "$BALANCE_3" "$BALANCE_2"
# TODO how to test second refund for same purchase?
exit_success