taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit a3354306c629ab3ab5f45617f31b90976416105a
parent ff50526560880ef070f1f6ec5a0a7eb4ae3fee2e
Author: Torsten Grote <t@grobox.de>
Date:   Mon, 18 May 2020 13:45:21 -0300

Add integration test for withdrawals

Diffstat:
Mintegrationtests/common.sh | 7+++++++
Aintegrationtests/test-coin-expiration.sh | 14++++++++++++++
Aintegrationtests/test-withdrawal.sh | 19+++++++++++++++++++
3 files changed, 40 insertions(+), 0 deletions(-)

diff --git 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 @@ -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 @@ -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