commit 9040df7a215e93e0a0d6d9605331d764f8c896ce parent c6138dede6d35f6535035bfdba620ab48741112c Author: MS <ms@taler.net> Date: Fri, 13 Jan 2023 15:58:30 +0100 move CLI tests Diffstat:
| M | Makefile | | | 4 | ++-- |
| R | cli/bin/circuit_test.sh -> cli/tests/circuit_test.sh | | | 0 | |
| R | cli/bin/circuit_test_file_tan.sh -> cli/tests/circuit_test_file_tan.sh | | | 0 | |
| R | cli/bin/debit_test.sh -> cli/tests/debit_test.sh | | | 0 | |
| A | cli/tests/libeufin-cli | | | 2 | ++ |
| A | cli/tests/registration_test.sh | | | 43 | +++++++++++++++++++++++++++++++++++++++++++ |
6 files changed, 47 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile @@ -35,8 +35,8 @@ assemble: .PHONY: check check: @./gradlew check - @cd ./cli/bin && ./circuit_test.sh - @cd ./cli/bin && ./debit_test.sh + @cd ./cli/tests && ./circuit_test.sh + @cd ./cli/tests && ./debit_test.sh # .PHONY: parse # parse: diff --git a/cli/bin/circuit_test.sh b/cli/tests/circuit_test.sh diff --git a/cli/bin/circuit_test_file_tan.sh b/cli/tests/circuit_test_file_tan.sh diff --git a/cli/bin/debit_test.sh b/cli/tests/debit_test.sh diff --git a/cli/tests/libeufin-cli b/cli/tests/libeufin-cli @@ -0,0 +1 @@ +../bin/libeufin-cli +\ No newline at end of file diff --git a/cli/tests/registration_test.sh b/cli/tests/registration_test.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +# Tests successful cases of the CLI acting +# as the client of the Circuit API. + +set -eu + +echo TESTING ACCESS API REGISTRATION +jq --version &> /dev/null || (echo "'jq' command not found"; exit 77) +curl --version &> /dev/null || (echo "'curl' command not found"; exit 77) + +DB_PATH=/tmp/registration-test.sqlite3 +export LIBEUFIN_SANDBOX_DB_CONNECTION=jdbc:sqlite:$DB_PATH + +echo -n Delete previous data.. +rm -f $DB_PATH +echo DONE +echo -n Configure the default demobank, with users limit 0... +libeufin-sandbox config default +echo DONE +echo -n Start the bank... +export LIBEUFIN_SANDBOX_ADMIN_PASSWORD=circuit +libeufin-sandbox serve &> sandbox.log & +SANDBOX_PID=$! +trap "echo -n 'killing the bank (pid $SANDBOX_PID)...'; kill $SANDBOX_PID; wait; echo DONE" EXIT +echo DONE +echo -n Wait for the bank... +curl --max-time 2 --retry-connrefused --retry-delay 1 --retry 10 http://localhost:5000/ &> /dev/null +echo DONE + +echo -n "Register new account..." +export LIBEUFIN_SANDBOX_USERNAME=www +export LIBEUFIN_SANDBOX_PASSWORD=foo + +./libeufin-cli \ + sandbox --sandbox-url http://localhost:5000/ \ + demobank \ + register +echo DONE + +echo -n Check the account is found... +curl -u "www:foo" http://localhost:5000/demobanks/default/access-api/accounts/www +echo DONE