make exchange test suite work with current bank

This commit is contained in:
Christian Grothoff 2019-12-23 11:47:16 +01:00
parent c58c5bce2b
commit e0cf954ad9
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
10 changed files with 80 additions and 44 deletions

View File

@ -1,9 +1,11 @@
SUBDIRS = . tos pp SUBDIRS = . tos pp
bin_SCRIPTS = \
taler-bank-manage-testing
EXTRA_DIST = \ EXTRA_DIST = \
auditor-report.tex.j2 \ auditor-report.tex.j2 \
coverage.sh \ coverage.sh \
gnunet.tag \ gnunet.tag \
microhttpd.tag \ microhttpd.tag \
render.py render.py

View File

@ -52,8 +52,8 @@ PLUGIN = taler_bank
# We also may need authentication data. # We also may need authentication data.
TALER_BANK_AUTH_METHOD = "none" # or basic TALER_BANK_AUTH_METHOD = "none" # or basic
# TALER_BANK_USERNAME = user # TALER_TALER_TESTING_BANK_USERNAME = user
# TALER_BANK_PASSWORD = pass # TALER_TALER_TESTING_BANK_PASSWORD = pass
# Accounts need to be enabled for the aggregator to debit them. # Accounts need to be enabled for the aggregator to debit them.
ENABLE_DEBIT = YES ENABLE_DEBIT = YES

View File

@ -0,0 +1,30 @@
#!/bin/sh
# This file is in the public domain
# Wrapper around 'taler-bank-manage' to first configure the required
# testing accounts before launching the bank properly.
#
# Takes 3 arguments:
# $1: the configuration file name
# $2: the database name
# $3: serve-http or serve-uwsgi
set -eu
# Reset database, provide starting accounts
taler-bank-manage -c $1 --with-db $2 django flush --no-input
taler-bank-manage -c $1 --with-db $2 django provide_accounts
# This is 'x' hashed by Django
PW_HASH='pbkdf2_sha256$180000$RBYjEO0WzE1z$x2Avt35TkOL2pMHvts3B1U1NIJalXZf95WnJhGFOAUs='
# hack password hash directly into the database:
echo "UPDATE auth_user SET password='$PW_HASH'" | psql -Aqt $2
# Note that calling
# taler-bank-manage -c $1 --with-db $2 django changepassword Bank x
# does not work: (1) it always insists on going interactive, and (2)
# rejects 'x' as a password.
# Now run Django for good
exec taler-bank-manage -c $1 --with-db $2 $3

View File

@ -96,7 +96,7 @@ mv a2e.dat $ABD
# Launch services # Launch services
echo "Launching services" echo "Launching services"
taler-bank-manage -c $CONF serve-http & taler-bank-manage-testing $CONF $TARGET_DB serve-http &
taler-exchange-httpd -c $CONF 2> taler-exchange-httpd.log & taler-exchange-httpd -c $CONF 2> taler-exchange-httpd.log &
taler-merchant-httpd -c $CONF -L INFO 2> taler-merchant-httpd.log & taler-merchant-httpd -c $CONF -L INFO 2> taler-merchant-httpd.log &
taler-exchange-wirewatch -c $CONF 2> taler-exchange-wirewatch.log & taler-exchange-wirewatch -c $CONF 2> taler-exchange-wirewatch.log &

View File

@ -23,7 +23,6 @@
#include "bank_api_common.h" #include "bank_api_common.h"
#include <microhttpd.h> /* just for HTTP status codes */ #include <microhttpd.h> /* just for HTTP status codes */
#include "taler_signatures.h" #include "taler_signatures.h"
// FIXME(dold): temporary hack
#include "taler_curl_lib.h" #include "taler_curl_lib.h"

View File

@ -92,7 +92,7 @@ run (void *cls,
struct TALER_TESTING_Command commands[] = { struct TALER_TESTING_Command commands[] = {
TALER_TESTING_cmd_bank_history ("history-0", TALER_TESTING_cmd_bank_history ("history-0",
bank_url, bank_url,
BANK_ACCOUNT_NUMBER, TALER_TESTING_BANK_ACCOUNT_NUMBER,
TALER_BANK_DIRECTION_BOTH, TALER_BANK_DIRECTION_BOTH,
GNUNET_YES, GNUNET_YES,
NULL, NULL,
@ -101,65 +101,65 @@ run (void *cls,
* the parameters, although it was always set as '200 OK' */ * the parameters, although it was always set as '200 OK' */
TRANSFER ("debit-1", TRANSFER ("debit-1",
"KUDOS:5.01", "KUDOS:5.01",
EXCHANGE_ACCOUNT_NUMBER, TALER_TESTING_EXCHANGE_ACCOUNT_NUMBER,
BANK_ACCOUNT_NUMBER, TALER_TESTING_BANK_ACCOUNT_NUMBER,
"subject 1"), "subject 1"),
TALER_TESTING_cmd_bank_history ("history-1c", TALER_TESTING_cmd_bank_history ("history-1c",
bank_url, bank_url,
BANK_ACCOUNT_NUMBER, TALER_TESTING_BANK_ACCOUNT_NUMBER,
TALER_BANK_DIRECTION_CREDIT, TALER_BANK_DIRECTION_CREDIT,
GNUNET_YES, GNUNET_YES,
NULL, NULL,
5), 5),
TALER_TESTING_cmd_bank_history ("history-1d", TALER_TESTING_cmd_bank_history ("history-1d",
bank_url, bank_url,
BANK_ACCOUNT_NUMBER, TALER_TESTING_BANK_ACCOUNT_NUMBER,
TALER_BANK_DIRECTION_DEBIT, TALER_BANK_DIRECTION_DEBIT,
GNUNET_YES, GNUNET_YES,
NULL, NULL,
5), 5),
TRANSFER ("debit-2", TRANSFER ("debit-2",
"KUDOS:3.21", "KUDOS:3.21",
EXCHANGE_ACCOUNT_NUMBER, TALER_TESTING_EXCHANGE_ACCOUNT_NUMBER,
USER_ACCOUNT_NUMBER, TALER_TESTING_USER_ACCOUNT_NUMBER,
"subject 2"), "subject 2"),
TRANSFER ("credit-2", TRANSFER ("credit-2",
"KUDOS:3.22", "KUDOS:3.22",
USER_ACCOUNT_NUMBER, TALER_TESTING_USER_ACCOUNT_NUMBER,
EXCHANGE_ACCOUNT_NUMBER, TALER_TESTING_EXCHANGE_ACCOUNT_NUMBER,
"credit 2"), "credit 2"),
TALER_TESTING_cmd_bank_history ("history-2b", TALER_TESTING_cmd_bank_history ("history-2b",
bank_url, bank_url,
EXCHANGE_ACCOUNT_NUMBER, TALER_TESTING_EXCHANGE_ACCOUNT_NUMBER,
TALER_BANK_DIRECTION_BOTH, TALER_BANK_DIRECTION_BOTH,
GNUNET_YES, GNUNET_YES,
NULL, NULL,
5), 5),
TALER_TESTING_cmd_bank_history ("history-2bi", TALER_TESTING_cmd_bank_history ("history-2bi",
bank_url, bank_url,
EXCHANGE_ACCOUNT_NUMBER, TALER_TESTING_EXCHANGE_ACCOUNT_NUMBER,
TALER_BANK_DIRECTION_BOTH, TALER_BANK_DIRECTION_BOTH,
GNUNET_YES, GNUNET_YES,
"debit-1", "debit-1",
5), 5),
TRANSFER ("credit-for-reject-1", TRANSFER ("credit-for-reject-1",
"KUDOS:1.01", "KUDOS:1.01",
BANK_ACCOUNT_NUMBER, TALER_TESTING_BANK_ACCOUNT_NUMBER,
EXCHANGE_ACCOUNT_NUMBER, TALER_TESTING_EXCHANGE_ACCOUNT_NUMBER,
"subject 3"), "subject 3"),
TALER_TESTING_cmd_bank_reject ("reject-1", TALER_TESTING_cmd_bank_reject ("reject-1",
bank_url, bank_url,
"credit-for-reject-1"), "credit-for-reject-1"),
TALER_TESTING_cmd_bank_history ("history-r1", TALER_TESTING_cmd_bank_history ("history-r1",
bank_url, bank_url,
BANK_ACCOUNT_NUMBER, TALER_TESTING_BANK_ACCOUNT_NUMBER,
TALER_BANK_DIRECTION_BOTH, TALER_BANK_DIRECTION_BOTH,
GNUNET_YES, GNUNET_YES,
NULL, NULL,
5), 5),
TALER_TESTING_cmd_bank_history ("history-r1c", TALER_TESTING_cmd_bank_history ("history-r1c",
bank_url, bank_url,
BANK_ACCOUNT_NUMBER, TALER_TESTING_BANK_ACCOUNT_NUMBER,
TALER_BANK_DIRECTION_BOTH TALER_BANK_DIRECTION_BOTH
| TALER_BANK_DIRECTION_CANCEL, | TALER_BANK_DIRECTION_CANCEL,
GNUNET_YES, GNUNET_YES,
@ -187,7 +187,7 @@ main (int argc,
/* These environment variables get in the way... */ /* These environment variables get in the way... */
unsetenv ("XDG_DATA_HOME"); unsetenv ("XDG_DATA_HOME");
unsetenv ("XDG_CONFIG_HOME"); unsetenv ("XDG_CONFIG_HOME");
GNUNET_log_setup ("test-bank-api-with-(fake)bank-new", GNUNET_log_setup ("test-bank-api",
"DEBUG", "DEBUG",
NULL); NULL);

View File

@ -93,7 +93,7 @@ run (void *cls,
TWISTED_BANK_URL), TWISTED_BANK_URL),
TALER_TESTING_cmd_bank_history ("history-0", TALER_TESTING_cmd_bank_history ("history-0",
TWISTED_BANK_URL, TWISTED_BANK_URL,
EXCHANGE_ACCOUNT_NUMBER, TALER_TESTING_EXCHANGE_ACCOUNT_NUMBER,
TALER_BANK_DIRECTION_BOTH, TALER_BANK_DIRECTION_BOTH,
GNUNET_NO, GNUNET_NO,
NULL, NULL,

View File

@ -41,18 +41,18 @@ struct TALER_BANK_AuthenticationData AUTHS[] = {
/* Bank credentials */ /* Bank credentials */
{.method = TALER_BANK_AUTH_BASIC, {.method = TALER_BANK_AUTH_BASIC,
.details.basic.username = BANK_USERNAME, .details.basic.username = TALER_TESTING_BANK_USERNAME,
.details.basic.password = BANK_PASSWORD}, .details.basic.password = TALER_TESTING_BANK_PASSWORD},
/* Exchange credentials */ /* Exchange credentials */
{.method = TALER_BANK_AUTH_BASIC, {.method = TALER_BANK_AUTH_BASIC,
.details.basic.username = EXCHANGE_USERNAME, .details.basic.username = TALER_TESTING_EXCHANGE_USERNAME,
.details.basic.password = EXCHANGE_PASSWORD }, .details.basic.password = TALER_TESTING_EXCHANGE_PASSWORD },
/* User credentials */ /* User credentials */
{.method = TALER_BANK_AUTH_BASIC, {.method = TALER_BANK_AUTH_BASIC,
.details.basic.username = USER_USERNAME, .details.basic.username = TALER_TESTING_USER_USERNAME,
.details.basic.password = USER_PASSWORD } .details.basic.password = TALER_TESTING_USER_PASSWORD }
}; };
@ -193,10 +193,10 @@ TALER_TESTING_run_bank (const char *config_filename,
(GNUNET_NO, (GNUNET_NO,
GNUNET_OS_INHERIT_STD_ALL, GNUNET_OS_INHERIT_STD_ALL,
NULL, NULL, NULL, NULL, NULL, NULL,
"taler-bank-manage", "taler-bank-manage-testing",
"taler-bank-manage", "taler-bank-manage-testing",
"-c", config_filename, config_filename,
"--with-db", database, database,
serve_arg, NULL); serve_arg, NULL);
GNUNET_free (database); GNUNET_free (database);
if (NULL == bank_proc) if (NULL == bank_proc)
@ -243,6 +243,9 @@ TALER_TESTING_run_bank (const char *config_filename,
* Prepare the bank execution. Check if the port is available * Prepare the bank execution. Check if the port is available
* and reset database. * and reset database.
* *
* NOTE: resetting the database is now done by taler-bank-manage-testing
* and should be removed here (once it works...)! FIXME!
*
* @param config_filename configuration file name. * @param config_filename configuration file name.
* *
* @return the base url, or NULL upon errors. Must be freed * @return the base url, or NULL upon errors. Must be freed

View File

@ -63,7 +63,7 @@ enum BenchmarkError
* the only requirement is that this number then matches the * the only requirement is that this number then matches the
* number given when building payto URLs at deposit time. * number given when building payto URLs at deposit time.
*/ */
#define USER_ACCOUNT_NUMBER 3 #define TALER_TESTING_USER_ACCOUNT_NUMBER 3
#define FIRST_INSTRUCTION -1 #define FIRST_INSTRUCTION -1
@ -72,7 +72,7 @@ enum BenchmarkError
(TALER_TESTING_cmd_fakebank_transfer (label, amount, \ (TALER_TESTING_cmd_fakebank_transfer (label, amount, \
exchange_bank_account.details. \ exchange_bank_account.details. \
x_taler_bank.bank_base_url, \ x_taler_bank.bank_base_url, \
USER_ACCOUNT_NUMBER, \ TALER_TESTING_USER_ACCOUNT_NUMBER, \
exchange_bank_account.details. \ exchange_bank_account.details. \
x_taler_bank.no, \ x_taler_bank.no, \
"dummy_user", \ "dummy_user", \
@ -321,7 +321,7 @@ run (void *cls,
withdraw_label, withdraw_label,
0, /* Index of the one withdrawn coin in the traits. */ 0, /* Index of the one withdrawn coin in the traits. */
TALER_TESTING_make_wire_details TALER_TESTING_make_wire_details
(USER_ACCOUNT_NUMBER, (TALER_TESTING_USER_ACCOUNT_NUMBER,
exchange_bank_account.details.x_taler_bank.hostname), exchange_bank_account.details.x_taler_bank.hostname),
order_enc, order_enc,
GNUNET_TIME_UNIT_ZERO, GNUNET_TIME_UNIT_ZERO,

View File

@ -35,15 +35,17 @@
/* ******** Credentials to log in at the bank ******* */ /* ******** Credentials to log in at the bank ******* */
#define BANK_ACCOUNT_NUMBER 1 /* Note that the same passwords must be set in the script in
#define BANK_USERNAME "Bank" contrib/taler-bank-manage-testing for the tests to work! */
#define BANK_PASSWORD "x" #define TALER_TESTING_BANK_ACCOUNT_NUMBER 1
#define EXCHANGE_ACCOUNT_NUMBER 2 #define TALER_TESTING_BANK_USERNAME "Bank"
#define EXCHANGE_USERNAME "Exchange" #define TALER_TESTING_BANK_PASSWORD "x"
#define EXCHANGE_PASSWORD "x" #define TALER_TESTING_EXCHANGE_ACCOUNT_NUMBER 2
#define USER_ACCOUNT_NUMBER 3 #define TALER_TESTING_EXCHANGE_USERNAME "Exchange"
#define USER_USERNAME "Tor" #define TALER_TESTING_EXCHANGE_PASSWORD "x"
#define USER_PASSWORD "x" #define TALER_TESTING_USER_ACCOUNT_NUMBER 3
#define TALER_TESTING_USER_USERNAME "Tor"
#define TALER_TESTING_USER_PASSWORD "x"
/* ********************* Helper functions ********************* */ /* ********************* Helper functions ********************* */