Add integration test for withdrawals
This commit is contained in:
parent
ff50526560
commit
a3354306c6
@ -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
|
||||
|
14
integrationtests/test-coin-expiration.sh
Executable file
14
integrationtests/test-coin-expiration.sh
Executable file
@ -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
|
19
integrationtests/test-withdrawal.sh
Executable file
19
integrationtests/test-withdrawal.sh
Executable file
@ -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
|
Loading…
Reference in New Issue
Block a user