From be1b6bd6f0fe257d248afca3e6cc2b1d3f753bf0 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 2 Sep 2021 17:31:25 -0300 Subject: correct test for issue #6912 --- src/testing/initialize_taler_system.sh | 2 +- src/testing/test_merchant_transfer_tracking.sh | 65 ++++++++++++++++++++++++-- 2 files changed, 63 insertions(+), 4 deletions(-) diff --git a/src/testing/initialize_taler_system.sh b/src/testing/initialize_taler_system.sh index 55cad2a9..f17ec2b5 100755 --- a/src/testing/initialize_taler_system.sh +++ b/src/testing/initialize_taler_system.sh @@ -140,7 +140,7 @@ echo " OK" echo -n "Waiting for the bank" # Wait for bank to be available (usually the slowest) -for n in `seq 1 10` +for n in `seq 1 30` do echo -n "." sleep 1 diff --git a/src/testing/test_merchant_transfer_tracking.sh b/src/testing/test_merchant_transfer_tracking.sh index 764e3d71..5a2a29e0 100755 --- a/src/testing/test_merchant_transfer_tracking.sh +++ b/src/testing/test_merchant_transfer_tracking.sh @@ -182,7 +182,7 @@ STATUS=$(curl 'http://localhost:9966/instances/default/private/transfers' \ -m 3 \ -w "%{http_code}" -s -o $LAST_RESPONSE) -if [ "$STATUS" != "404" ] +if [ "$STATUS" != "200" ] then jq . < $LAST_RESPONSE exit_fail "Expected response ok, after providing transfer data. got: $STATUS" @@ -203,10 +203,10 @@ fi TRANSFERS_LIST_SIZE=`jq -r '.transfers | length' < $LAST_RESPONSE` -if [ "$TRANSFERS_LIST_SIZE" != "0" ] +if [ "$TRANSFERS_LIST_SIZE" != "1" ] then jq . < $LAST_RESPONSE - exit_fail "Expected response ok. got: $STATUS" + exit_fail "Expected one transfer. got: $TRANSFERS_LIST_SIZE" fi echo "OK" @@ -248,10 +248,69 @@ WAS_WIRED=`jq -r .wired < $LAST_RESPONSE` if [ "$WAS_WIRED" == "true" ] then + jq . < $LAST_RESPONSE echo '.wired true, expected false' exit 1 fi echo " OK" +echo -n "Notifying merchant of correct wire transfer in the correct instance..." +#this time in the correct instance so the order will be marked as wired... + +STATUS=$(curl 'http://localhost:9966/instances/test/private/transfers' \ + -d '{"credit_amount":"'$CREDIT_AMOUNT'","wtid":"'$WTID'","payto_uri":"'$TARGET_PAYTO'","exchange_url":"'$WURL'"}' \ + -m 3 \ + -w "%{http_code}" -s -o $LAST_RESPONSE) + +if [ "$STATUS" != "200" ] +then + jq . < $LAST_RESPONSE + exit_fail "Expected response ok, after providing transfer data. got: $STATUS" +fi +echo " OK" + +echo -n "Fetching wire transfers of TEST instance ..." + +STATUS=$(curl 'http://localhost:9966/instances/test/private/transfers' \ + -w "%{http_code}" -s -o $LAST_RESPONSE) + +if [ "$STATUS" != "200" ] +then + jq . < $LAST_RESPONSE + exit_fail "Expected response 200 Ok. got: $STATUS" +fi + +TRANSFERS_LIST_SIZE=`jq -r '.transfers | length' < $LAST_RESPONSE` + +if [ "$TRANSFERS_LIST_SIZE" != "1" ] +then + jq . < $LAST_RESPONSE + exit_fail "Expected one transfer. got: $TRANSFERS_LIST_SIZE" +fi + +echo "OK" + +echo -n "Checking order status ..." +STATUS=$(curl "http://localhost:9966/instances/test/private/orders/${ORDER_ID}?transfer=YES" \ + -w "%{http_code}" -s -o $LAST_RESPONSE) + +if [ "$STATUS" != "200" ] +then + jq . < $LAST_RESPONSE + exit_fail 'should response ok, after order inquiry. got:' $STATUS `cat $LAST_RESPONSE` + exit 1 +fi + +WAS_WIRED=`jq -r .wired < $LAST_RESPONSE` + +if [ "$WAS_WIRED" != "true" ] +then + jq . < $LAST_RESPONSE + echo '.wired false, expected true' + exit 1 +fi + +echo " OK" + exit 0 -- cgit v1.2.3