summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2022-07-21 11:58:53 -0300
committerSebastian <sebasjm@gmail.com>2022-07-21 11:58:53 -0300
commit41cb0eeea7a6ca9eab617d061c9a9bc3ead162b7 (patch)
tree21aad4e080d444ac93ce4745a750aa9de029a011 /src
parentbbfd5f189b6db0b6b96b3e8d8d8e60f576dd0e98 (diff)
downloadmerchant-41cb0eeea7a6ca9eab617d061c9a9bc3ead162b7.tar.gz
merchant-41cb0eeea7a6ca9eab617d061c9a9bc3ead162b7.tar.bz2
merchant-41cb0eeea7a6ca9eab617d061c9a9bc3ead162b7.zip
updating instance token using management API
Diffstat (limited to 'src')
-rwxr-xr-xsrc/testing/test_merchant_instance_auth.sh37
1 files changed, 35 insertions, 2 deletions
diff --git a/src/testing/test_merchant_instance_auth.sh b/src/testing/test_merchant_instance_auth.sh
index b918352b..7dec5de9 100755
--- 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