aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/testing/test_merchant_instance_auth.sh21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/testing/test_merchant_instance_auth.sh b/src/testing/test_merchant_instance_auth.sh
index 7dec5de9..f4534b9a 100755
--- a/src/testing/test_merchant_instance_auth.sh
+++ b/src/testing/test_merchant_instance_auth.sh
@@ -17,6 +17,12 @@
# <http://www.gnu.org/licenses/>
#
+# Exit, with status code "skip" (no 'real' failure)
+function exit_skip() {
+ echo $1
+ exit 77
+}
+
. initialize_taler_system.sh
@@ -39,7 +45,7 @@ echo " OK"
kill $MERCHANT_HTTPD_PID
wait $MERCHANT_HTTPD_PID
-NEW_SECRET=different_value
+NEW_SECRET=secret-token:different_value
taler-merchant-httpd -a "${NEW_SECRET}" -c "${CONF}" -L DEBUG 2> taler-merchant-httpd.log &
MERCHANT_HTTPD_PID=$!
@@ -58,10 +64,15 @@ do
break
done
+if [ "x$OK" != "x1" ]
+then
+ exit_skip "Failed to start merchant backend"
+fi
+
echo -n "Creating order to test auth is ok..."
STATUS=$(curl -H "Content-Type: application/json" -X POST \
'http://localhost:9966/instances/default/private/orders' \
- -H 'Authorization: Bearer secret-token:'$NEW_SECRET \
+ -H 'Authorization: Bearer '$NEW_SECRET \
-d '{"order":{"amount":"TESTKUDOS:1","summary":"payme"}}' \
-w "%{http_code}" -s -o $LAST_RESPONSE)
@@ -75,7 +86,7 @@ ORDER_ID=`jq -e -r .order_id < $LAST_RESPONSE`
TOKEN=`jq -e -r .token < $LAST_RESPONSE`
STATUS=$(curl "http://localhost:9966/instances/default/private/orders/${ORDER_ID}" \
- -H 'Authorization: Bearer secret-token:'$NEW_SECRET \
+ -H 'Authorization: Bearer '$NEW_SECRET \
-w "%{http_code}" -s -o $LAST_RESPONSE)
if [ "$STATUS" != "200" ]
@@ -91,7 +102,7 @@ echo OK order $ORDER_ID with $TOKEN
echo -n "Configuring 'second' instance ..."
STATUS=$(curl -H "Content-Type: application/json" -X POST \
- -H 'Authorization: Bearer secret-token:'$NEW_SECRET \
+ -H 'Authorization: Bearer '$NEW_SECRET \
http://localhost:9966/management/instances \
-d '{"auth":{"method":"token","token":"secret-token:second"},"payto_uris":["payto://x-taler-bank/localhost/43"],"id":"second","name":"second","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000}}' \
-w "%{http_code}" -s -o /dev/null)
@@ -107,7 +118,7 @@ echo "OK"
echo -n "Updating 'second' instance token using the 'default' auth token..."
STATUS=$(curl -H "Content-Type: application/json" -X POST \
- -H 'Authorization: Bearer secret-token:'$NEW_SECRET \
+ -H 'Authorization: Bearer '$NEW_SECRET \
http://localhost:9966/management/instances/second/auth \
-d '{"method":"token","token":"secret-token:new_one"}' \
-w "%{http_code}" -s -o /dev/null)