[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] 01/02: move CLI tests
From: |
gnunet |
Subject: |
[libeufin] 01/02: move CLI tests |
Date: |
Fri, 13 Jan 2023 16:03:01 +0100 |
This is an automated email from the git hooks/post-receive script.
ms pushed a commit to branch master
in repository libeufin.
commit 9040df7a215e93e0a0d6d9605331d764f8c896ce
Author: MS <ms@taler.net>
AuthorDate: Fri Jan 13 15:58:30 2023 +0100
move CLI tests
---
Makefile | 4 +--
cli/{bin => tests}/circuit_test.sh | 0
cli/{bin => tests}/circuit_test_file_tan.sh | 0
cli/{bin => tests}/debit_test.sh | 0
cli/tests/libeufin-cli | 1 +
cli/tests/registration_test.sh | 43 +++++++++++++++++++++++++++++
6 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 6597f3c2..91576dbf 100644
--- 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
similarity index 100%
rename from cli/bin/circuit_test.sh
rename to cli/tests/circuit_test.sh
diff --git a/cli/bin/circuit_test_file_tan.sh
b/cli/tests/circuit_test_file_tan.sh
similarity index 100%
rename from cli/bin/circuit_test_file_tan.sh
rename to cli/tests/circuit_test_file_tan.sh
diff --git a/cli/bin/debit_test.sh b/cli/tests/debit_test.sh
similarity index 100%
rename from cli/bin/debit_test.sh
rename to cli/tests/debit_test.sh
diff --git a/cli/tests/libeufin-cli b/cli/tests/libeufin-cli
new file mode 120000
index 00000000..c69a3d87
--- /dev/null
+++ 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
new file mode 100755
index 00000000..0e561cbc
--- /dev/null
+++ 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
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.