gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-merchant] 01/02: clean up test logic a bit


From: gnunet
Subject: [taler-merchant] 01/02: clean up test logic a bit
Date: Sat, 27 May 2023 19:53:08 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository merchant.

commit 1bfaf0a19f664c313e887cc25cfb80891cd66d3a
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sat May 27 19:31:23 2023 +0200

    clean up test logic a bit
---
 src/testing/test_merchant_reserve_creation.sh | 35 ++++++++++++---------------
 1 file changed, 16 insertions(+), 19 deletions(-)

diff --git a/src/testing/test_merchant_reserve_creation.sh 
b/src/testing/test_merchant_reserve_creation.sh
index cf231dd5..753b5e41 100755
--- a/src/testing/test_merchant_reserve_creation.sh
+++ b/src/testing/test_merchant_reserve_creation.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 # This file is part of TALER
-# Copyright (C) 2014-2021 Taler Systems SA
+# Copyright (C) 2014-2023 Taler Systems SA
 #
 # TALER is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as
@@ -25,6 +25,9 @@ echo -n "Configuring merchant instance ..."
 
 # create instance
 FORTYTHREE=`get_payto_uri fortythree x`
+echo -n "."
+bash
+
 STATUS=$(curl -H "Content-Type: application/json" -X POST \
     -H 'Authorization: Bearer secret-token:super_secret' \
     http://localhost:9966/management/instances \
@@ -33,8 +36,7 @@ STATUS=$(curl -H "Content-Type: application/json" -X POST \
 
 if [ "$STATUS" != "204" ]
 then
-    echo 'Expected 204, instance created. Got instead: ' $STATUS
-    exit 1
+    exit_fail "Expected 204, instance created. Got instead: $STATUS"
 fi
 echo "OK"
 
@@ -45,8 +47,7 @@ STATUS=$(curl 
'http://localhost:9966/instances/default/private/reserves' \
 
 if [ "$STATUS" != "200" ]
 then
-    echo 'Expected 200, reserve created. Got instead: ' $STATUS
-    exit 1
+    exit_fail "Expected 200, reserve created. Got instead: $STATUS"
 fi
 
 echo "OK"
@@ -60,9 +61,8 @@ FUNDED=`jq -r '.merchant_initial_amount == 
.exchange_initial_amount' < $LAST_RES
 
 if [ "$FUNDED" != "false" ]
 then
-    echo 'Should not yet be funded if we just created. Got:' $STATUS 'is 
founded: ' $FUNDED
     cat $LAST_RESPONSE
-    exit 1
+    exit_fail "Should not yet be funded if we just created. Got: $STATUS is 
founded:  $FUNDED"
 fi
 
 
@@ -94,13 +94,15 @@ taler-exchange-wirewatch -c $CONF -t -L INFO &> 
taler-exchange-wirewatch.log
 STATUS=$(curl 
'http://localhost:9966/instances/default/private/reserves/'$RESERVE_PUB \
     -w "%{http_code}" -s -o $LAST_RESPONSE)
 
+export LAST_RESPONSE
+
+bash
 FUNDED=`jq -r '.merchant_initial_amount == .exchange_initial_amount' < 
$LAST_RESPONSE`
 
 if [ "$FUNDED" != "true" ]
 then
-    echo 'should be funded. got:' $STATUS 'is founded: ' $FUNDED
     cat $LAST_RESPONSE
-    exit 1
+    exit_fail "should be funded. got: $STATUS is founded:  $FUNDED"
 fi
 
 
@@ -112,8 +114,7 @@ STATUS=$(curl 
'http://localhost:9966/instances/default/private/reserves/'$RESERV
 
 if [ "$STATUS" != "200" ]
 then
-    echo 'should respond failed, we did not fund yet. got:' $STATUS
-    exit 1
+    exit_fail "should respond failed, we did not fund yet. got: $STATUS"
 fi
 
 echo OK
@@ -126,9 +127,8 @@ TIPS_SIZE=`jq -r ".tips | length"  < $LAST_RESPONSE`
 
 if [ "$TIPS_SIZE" != "1" ]
 then
-    echo 'should respond 1, just 1 tip. got:' $TIPS_SIZE
     cat $LAST_RESPONSE
-    exit 1
+    exit_fail "should respond 1, just 1 tip. got: $TIPS_SIZE"
 fi
 
 TIP_ID=`jq -r .tips[0].tip_id < $LAST_RESPONSE`
@@ -142,9 +142,8 @@ STATUS=$(curl 
'http://localhost:9966/instances/default/private/tips/'$TIP_ID \
 
 if [ "$STATUS" != "200" ]
 then
-    echo 'should respond ok, tip found. got:' $STATUS
     cat $LAST_RESPONSE
-    exit 1
+    exit_fail "should respond ok, tip found. got: $STATUS"
 fi
 
 echo -n " ... "
@@ -154,9 +153,8 @@ STATUS=$(curl 
'http://localhost:9966/instances/default/private/tips/'$TIP_ID'?pi
 
 if [ "$STATUS" != "200" ]
 then
-    echo 'should respond ok, tip found. got:' $STATUS
     cat $LAST_RESPONSE
-    exit 1
+    exit_fail "should respond ok, tip found. got: $STATUS"
 fi
 
 echo OK
@@ -169,8 +167,7 @@ STATUS=$(curl 
'http://localhost:9966/instances/default/private/reserves' \
 
 if [ "$STATUS" != "400" ]
 then
-    echo 'should respond invalid, bad currency. got:' $STATUS
-    exit 1
+    exit_fail 'Should respond invalid, bad currency. got: $STATUS"
 fi
 
 echo "FAILED (which is ok)"

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]