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
bin_SCRIPTS = \
taler-bank-manage-testing
EXTRA_DIST = \
auditor-report.tex.j2 \
coverage.sh \
gnunet.tag \
microhttpd.tag \
render.py

View File

@ -52,8 +52,8 @@ PLUGIN = taler_bank
# We also may need authentication data.
TALER_BANK_AUTH_METHOD = "none" # or basic
# TALER_BANK_USERNAME = user
# TALER_BANK_PASSWORD = pass
# TALER_TALER_TESTING_BANK_USERNAME = user
# TALER_TALER_TESTING_BANK_PASSWORD = pass
# Accounts need to be enabled for the aggregator to debit them.
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
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-merchant-httpd -c $CONF -L INFO 2> taler-merchant-httpd.log &
taler-exchange-wirewatch -c $CONF 2> taler-exchange-wirewatch.log &

View File

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

View File

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

View File

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

View File

@ -41,18 +41,18 @@ struct TALER_BANK_AuthenticationData AUTHS[] = {
/* Bank credentials */
{.method = TALER_BANK_AUTH_BASIC,
.details.basic.username = BANK_USERNAME,
.details.basic.password = BANK_PASSWORD},
.details.basic.username = TALER_TESTING_BANK_USERNAME,
.details.basic.password = TALER_TESTING_BANK_PASSWORD},
/* Exchange credentials */
{.method = TALER_BANK_AUTH_BASIC,
.details.basic.username = EXCHANGE_USERNAME,
.details.basic.password = EXCHANGE_PASSWORD },
.details.basic.username = TALER_TESTING_EXCHANGE_USERNAME,
.details.basic.password = TALER_TESTING_EXCHANGE_PASSWORD },
/* User credentials */
{.method = TALER_BANK_AUTH_BASIC,
.details.basic.username = USER_USERNAME,
.details.basic.password = USER_PASSWORD }
.details.basic.username = TALER_TESTING_USER_USERNAME,
.details.basic.password = TALER_TESTING_USER_PASSWORD }
};
@ -193,10 +193,10 @@ TALER_TESTING_run_bank (const char *config_filename,
(GNUNET_NO,
GNUNET_OS_INHERIT_STD_ALL,
NULL, NULL, NULL,
"taler-bank-manage",
"taler-bank-manage",
"-c", config_filename,
"--with-db", database,
"taler-bank-manage-testing",
"taler-bank-manage-testing",
config_filename,
database,
serve_arg, NULL);
GNUNET_free (database);
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
* 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.
*
* @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
* 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
@ -72,7 +72,7 @@ enum BenchmarkError
(TALER_TESTING_cmd_fakebank_transfer (label, amount, \
exchange_bank_account.details. \
x_taler_bank.bank_base_url, \
USER_ACCOUNT_NUMBER, \
TALER_TESTING_USER_ACCOUNT_NUMBER, \
exchange_bank_account.details. \
x_taler_bank.no, \
"dummy_user", \
@ -321,7 +321,7 @@ run (void *cls,
withdraw_label,
0, /* Index of the one withdrawn coin in the traits. */
TALER_TESTING_make_wire_details
(USER_ACCOUNT_NUMBER,
(TALER_TESTING_USER_ACCOUNT_NUMBER,
exchange_bank_account.details.x_taler_bank.hostname),
order_enc,
GNUNET_TIME_UNIT_ZERO,

View File

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