[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] branch master updated: -fix order creation test
From: |
gnunet |
Subject: |
[taler-merchant] branch master updated: -fix order creation test |
Date: |
Sat, 06 May 2023 18:40:42 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository merchant.
The following commit(s) were added to refs/heads/master by this push:
new 22ca9c89 -fix order creation test
22ca9c89 is described below
commit 22ca9c89152aff6272418fa9726072787aa963cc
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sat May 6 18:40:38 2023 +0200
-fix order creation test
---
src/testing/test_merchant_order_creation.sh | 64 +++++++----------------------
1 file changed, 14 insertions(+), 50 deletions(-)
diff --git a/src/testing/test_merchant_order_creation.sh
b/src/testing/test_merchant_order_creation.sh
index 754cdc25..1b1aeb23 100755
--- a/src/testing/test_merchant_order_creation.sh
+++ b/src/testing/test_merchant_order_creation.sh
@@ -377,27 +377,14 @@ STATUS=$(curl
'http://localhost:9966/instances/default/private/transfers' \
-m 3 \
-w "%{http_code}" -s -o $LAST_RESPONSE)
-if [ "$STATUS" != "409" ]
+if [ "$STATUS" != "204" ]
then
jq . < $LAST_RESPONSE
exit_fail "Expected to fail since the amount is not valid. got: $STATUS"
fi
echo "OK"
-echo -n "Notifying merchant of bogus wire transfer AGAIN ..."
-
-STATUS=$(curl 'http://localhost:9966/instances/default/private/transfers' \
- -d
'{"credit_amount":"'$CREDIT_AMOUNT'1","wtid":"'$WTID'","payto_uri":"'$TARGET_PAYTO'","exchange_url":"'$WURL'"}'
\
- -m 3 \
- -w "%{http_code}" -s -o $LAST_RESPONSE)
-
-if [ "$STATUS" != "409" ]
-then
- jq . < $LAST_RESPONSE
- exit_fail "Expected to fail since the amount is not valid. got: $STATUS"
-fi
-echo " OK"
echo -n "Notifying merchant of correct wire transfer (conflicting with old
data)..."
STATUS=$(curl 'http://localhost:9966/instances/default/private/transfers' \
@@ -444,45 +431,37 @@ STATUS=$(curl
'http://localhost:9966/instances/default/private/transfers' \
-m 3 \
-w "%{http_code}" -s -o $LAST_RESPONSE)
-if [ "$STATUS" != "200" ]
+if [ "$STATUS" != "204" ]
then
jq . < $LAST_RESPONSE
- exit_fail "Expected response ok, after providing transfer data. got:
$STATUS"
+ exit_fail "Expected response 204 No content, after providing transfer
data. got: $STATUS"
fi
echo " OK"
+
echo -n "Testing idempotence ..."
set -e
+
# Test idempotence: do it again!
STATUS=$(curl 'http://localhost:9966/instances/default/private/transfers' \
-d
'{"credit_amount":"'$CREDIT_AMOUNT'","wtid":"'$WTID'","payto_uri":"'$TARGET_PAYTO'","exchange_url":"'$WURL'"}'
\
-w "%{http_code}" -s -o $LAST_RESPONSE)
-if [ "$STATUS" != "200" ]
+if [ "$STATUS" != "204" ]
then
jq . < $LAST_RESPONSE
- exit_fail "Expected response ok, after providing transfer data. got:
$STATUS"
+ exit_fail "Expected response No Content, after providing transfer data.
got: $STATUS"
fi
echo " OK"
-echo -n "Sending bogus WTID ..."
-#
-# CHECK TRANSFER API
-#
-
-STATUS=$(curl 'http://localhost:9966/instances/default/private/transfers' \
- -d
'{"credit_amount":"'$CREDIT_AMOUNT'","wtid":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","payto_uri":"'$TARGET_PAYTO'","exchange_url":"'$WURL'"}'
\
- -w "%{http_code}" -s -o $LAST_RESPONSE)
+echo -n "Testing taler-merchant-exchange ..."
+set -e
+taler-merchant-exchange -L INFO -c $CONF -t &> taler-merchant-exchange.log
+echo " OK"
-if [ "$STATUS" != "502" ]
-then
- jq . < $LAST_RESPONSE
- exit_fail "Expected response invalid since the WTID is fake. got: $STATUS"
-fi
-echo "OK"
echo -n "Fetching wire transfers ..."
STATUS=$(curl 'http://localhost:9966/instances/default/private/transfers' \
@@ -496,28 +475,13 @@ fi
TRANSFERS_LIST_SIZE=`jq -r '.transfers | length' < $LAST_RESPONSE`
-if [ "$TRANSFERS_LIST_SIZE" != "2" ]
+if [ "$TRANSFERS_LIST_SIZE" != "1" ]
then
jq . < $LAST_RESPONSE
- exit_fail "Expected response ok. got: $STATUS"
+ exit_fail "Expected 1 entry in transfer list. Got: $TRANSFERS_LIST_SIZE"
fi
echo "OK"
-echo -n "Fetching wire transfer details of bogus WTID ..."
-
-# Test for #6854: use a bogus WTID, causing the exchange to fail to
-# find the WTID.
-STATUS=$(curl 'http://localhost:9966/instances/default/private/transfers' \
- -d
'{"credit_amount":"'$CREDIT_AMOUNT'","wtid":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","payto_uri":"'$TARGET_PAYTO'","exchange_url":"'$WURL'"}'
\
- -w "%{http_code}" -s -o $LAST_RESPONSE)
-
-if [ "$STATUS" != "502" ]
-then
- jq . < $LAST_RESPONSE
- exit_fail "Expected response invalid since the WTID is fake. got: $STATUS"
-fi
-
-echo " OK"
echo -n "Checking order status ..."
@@ -529,7 +493,7 @@ STATUS=$(curl
"http://localhost:9966/instances/default/private/orders/${ORDER_ID
if [ "$STATUS" != "200" ]
then
jq . < $LAST_RESPONSE
- exit_fail 'should response ok, after order inquiry. got:' $STATUS `cat
$LAST_RESPONSE`
+ exit_fail 'should respond 200 ok, after order inquiry. got:' $STATUS `cat
$LAST_RESPONSE`
exit 1
fi
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-merchant] branch master updated: -fix order creation test,
gnunet <=