diff options
author | Christian Grothoff <christian@grothoff.org> | 2023-06-22 16:30:55 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2023-06-22 16:30:55 +0200 |
commit | 99543152e9ddb1aab29d4e69dffb26c97d36040a (patch) | |
tree | a15f35206bf35183e986add028e684d59f31c310 /src/testing/test_merchant_instance_response.sh | |
parent | 52c49785fe20844a52f083de4adf9fea6e0c403d (diff) | |
download | merchant-99543152e9ddb1aab29d4e69dffb26c97d36040a.tar.gz merchant-99543152e9ddb1aab29d4e69dffb26c97d36040a.tar.bz2 merchant-99543152e9ddb1aab29d4e69dffb26c97d36040a.zip |
-clean up test scripts
Diffstat (limited to 'src/testing/test_merchant_instance_response.sh')
-rwxr-xr-x | src/testing/test_merchant_instance_response.sh | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/src/testing/test_merchant_instance_response.sh b/src/testing/test_merchant_instance_response.sh index 5f175b0b..b94f8dcf 100755 --- a/src/testing/test_merchant_instance_response.sh +++ b/src/testing/test_merchant_instance_response.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 @@ -17,9 +17,11 @@ # <http://www.gnu.org/licenses/> # -. initialize_taler_system.sh +. setup.sh + +# Launch only the merchant. +setup -c test_template.conf -m -# echo -n "Configuring merchant instance ..." STATUS=$(curl -H "Content-Type: application/json" -X OPTIONS \ http://localhost:9966/instances/default/private/products \ @@ -27,8 +29,7 @@ STATUS=$(curl -H "Content-Type: application/json" -X OPTIONS \ if [ "$STATUS" != "204" ] then - echo 'options should return 204 when default instance doest not exist yet. got:' $STATUS - exit 1 + exit_fail "Expected 204 when default instance doest not exist yet. got: $STATUS" fi STATUS=$(curl -H "Content-Type: application/json" -X GET \ @@ -38,8 +39,7 @@ STATUS=$(curl -H "Content-Type: application/json" -X GET \ if [ "$STATUS" != "404" ] then - echo 'backend should respond 404 when the default instance is not yet created. got:' $STATUS - exit 1 + exit_fail "Expected 404 when the default instance is not yet created. got: $STATUS" fi STATUS=$(curl -H "Content-Type: application/json" -X POST \ @@ -50,8 +50,7 @@ STATUS=$(curl -H "Content-Type: application/json" -X POST \ if [ "$STATUS" != "204" ] then - echo 'should respond ok, instance created. got:' $STATUS - exit 1 + exit_fail "Expected 204, instance created. got: $STATUS" fi STATUS=$(curl -H "Content-Type: application/json" -X GET \ @@ -60,8 +59,7 @@ STATUS=$(curl -H "Content-Type: application/json" -X GET \ if [ "$STATUS" != "401" ] then - echo 'should respond unauthorized without the token for the list of product when the default instance was created. got:' $STATUS - exit 1 + exit_fail "Expected 401 without the token for the list of product when the default instance was created. got: $STATUS" fi STATUS=$(curl -H "Content-Type: application/json" -X GET \ @@ -71,8 +69,7 @@ STATUS=$(curl -H "Content-Type: application/json" -X GET \ if [ "$STATUS" != "200" ] then - echo 'should respond ok for the list of product when the default instance was created. got:' $STATUS - exit 1 + exit_fail "Expected 200 for the list of product when the default instance was created. got: $STATUS" fi STATUS=$(curl -H "Content-Type: application/json" -X POST \ @@ -83,8 +80,7 @@ STATUS=$(curl -H "Content-Type: application/json" -X POST \ if [ "$STATUS" != "204" ] then - echo 'should respond ok, instance auth token changed. got:' $STATUS - exit 1 + exit_fail "Expected 204, instance auth token changed. got: $STATUS" fi @@ -95,8 +91,7 @@ STATUS=$(curl -H "Content-Type: application/json" -X DELETE \ if [ "$STATUS" != "401" ] then - echo 'should respond unauthorized without the token, when purging the instance. got:' $STATUS - exit 1 + exit_fail "Expected 401 without the token, when purging the instance. got: $STATUS" fi STATUS=$(curl -H "Content-Type: application/json" -X DELETE \ @@ -106,8 +101,7 @@ STATUS=$(curl -H "Content-Type: application/json" -X DELETE \ if [ "$STATUS" != "401" ] then - echo 'should respond unauthorized using old token, when purging the instance. got:' $STATUS - exit 1 + exit_fail "Expected 401 using old token, when purging the instance. got: $STATUS" fi STATUS=$(curl -H "Content-Type: application/json" -X DELETE \ @@ -117,8 +111,7 @@ STATUS=$(curl -H "Content-Type: application/json" -X DELETE \ if [ "$STATUS" != "204" ] then - echo 'should respond unauthorized without the token, when purging the instance. got:' $STATUS - exit 1 + exit_fail "Expected 204 when purging the instance. got: $STATUS" fi STATUS=$(curl -H "Content-Type: application/json" -X GET \ @@ -128,10 +121,9 @@ STATUS=$(curl -H "Content-Type: application/json" -X GET \ if [ "$STATUS" != "404" ] then - echo 'should respond not found when trying to list the product and the default instance was deleted. got:' $STATUS - exit 1 + exit_fail "Expected 404 when trying to list the product and the default instance was deleted. got: $STATUS" fi -echo "OK" +echo "Test PASSED" exit 0 |