diff options
-rw-r--r-- | integrationtests/common.sh | 7 | ||||
-rwxr-xr-x | integrationtests/test-coin-expiration.sh | 14 | ||||
-rwxr-xr-x | integrationtests/test-withdrawal.sh | 19 |
3 files changed, 40 insertions, 0 deletions
diff --git a/integrationtests/common.sh b/integrationtests/common.sh index 86158d153..d228d1ea5 100644 --- a/integrationtests/common.sh +++ b/integrationtests/common.sh @@ -114,6 +114,9 @@ function wait_for_services() { OK=1 break done + if [ 1 != $OK ]; then + exit_skip "Failed to launch bank" + fi # Wait for all other services to be available for _ in $(seq 1 50); do echo -n "." @@ -170,6 +173,10 @@ function assert_greater_than() { fi } +function assert_equal() { + [[ "$1" == "$2" ]] || exit_error "$1 is not equal to $2" +} + function shutdown_services() { echo "Shutting down services" jobs -p | xargs --no-run-if-empty kill || true diff --git a/integrationtests/test-coin-expiration.sh b/integrationtests/test-coin-expiration.sh new file mode 100755 index 000000000..83f7477bf --- /dev/null +++ b/integrationtests/test-coin-expiration.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# Script to check that the wallet automatically refreshes coins for they expire + +source "common.sh" +normal_start_and_wait "coin-expiration" + +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 "Balance after withdrawal: $(get_balance)" + +# TODO time-travel to check that wallet actually refreshed coin before expiration +taler-wallet-cli --wallet-db="$WALLET_DB" advanced dump-coins + +exit_success diff --git a/integrationtests/test-withdrawal.sh b/integrationtests/test-withdrawal.sh new file mode 100755 index 000000000..1450f6258 --- /dev/null +++ b/integrationtests/test-withdrawal.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# Script to check that the wallet does a withdrawal correctly + +source "common.sh" +normal_start_and_wait "withdrawal" + +echo "Withdraw 5 TESTKUDOS" +taler-wallet-cli --wallet-db="$WALLET_DB" --no-throttle testing withdraw -e "$EXCHANGE_URL" -b "$BANK_URL" -a "TESTKUDOS:5" >>"$LOG" 2>>"$LOG" +BALANCE_1=$(get_balance) +assert_equal "$BALANCE_1" "TESTKUDOS:4.84" +echo "Balance after withdrawal: $BALANCE_1" + +echo "Withdraw 10 TESTKUDOS" +taler-wallet-cli --wallet-db="$WALLET_DB" --no-throttle testing withdraw -e "$EXCHANGE_URL" -b "$BANK_URL" -a "TESTKUDOS:10" >>"$LOG" 2>>"$LOG" +BALANCE_2=$(get_balance) +assert_equal "$BALANCE_2" "TESTKUDOS:14.66" +echo "Balance after withdrawal: $BALANCE_2" + +exit_success |