commit 41cb0eeea7a6ca9eab617d061c9a9bc3ead162b7
parent bbfd5f189b6db0b6b96b3e8d8d8e60f576dd0e98
Author: Sebastian <sebasjm@gmail.com>
Date: Thu, 21 Jul 2022 11:58:53 -0300
updating instance token using management API
Diffstat:
1 file changed, 35 insertions(+), 2 deletions(-)
diff --git a/src/testing/test_merchant_instance_auth.sh b/src/testing/test_merchant_instance_auth.sh
@@ -59,7 +59,7 @@ do
done
echo -n "Creating order to test auth is ok..."
-STATUS=$(curl -v -H "Content-Type: application/json" -X POST \
+STATUS=$(curl -H "Content-Type: application/json" -X POST \
'http://localhost:9966/instances/default/private/orders' \
-H 'Authorization: Bearer secret-token:'$NEW_SECRET \
-d '{"order":{"amount":"TESTKUDOS:1","summary":"payme"}}' \
@@ -86,6 +86,39 @@ fi
PAY_URL=`jq -e -r .taler_pay_uri < $LAST_RESPONSE`
-echo OK order $ORDER_ID with $TOKEN can be paid using $PAY_URL
+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 \
+ 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)
+
+if [ "$STATUS" != "204" ]
+then
+ echo 'should respond ok, instance created. got:' $STATUS
+ exit 1
+fi
+
+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 \
+ http://localhost:9966/management/instances/second/auth \
+ -d '{"method":"token","token":"secret-token:new_one"}' \
+ -w "%{http_code}" -s -o /dev/null)
+
+if [ "$STATUS" != "204" ]
+then
+ echo 'should respond ok, instance auth token changed. got:' $STATUS
+ exit 1
+fi
+
+echo " OK"
+
exit 0