aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2020-01-17 12:15:57 +0100
committerFlorian Dold <florian.dold@gmail.com>2020-01-17 12:15:57 +0100
commit099884ee66fc642179c9ad799a61f0b1a6d8cdc9 (patch)
tree9a4d3d884b24494f68c7f83801227631c2c96265 /src
parent21afdac1f3d75be7def83ac76e59cd2affc38ca0 (diff)
split config files, towards making pybank test case work again
Diffstat (limited to 'src')
-rw-r--r--src/lib/test_bank_api.c14
-rw-r--r--src/lib/test_bank_api.conf10
-rw-r--r--src/lib/test_bank_api_fakebank.conf17
-rw-r--r--src/lib/test_bank_api_pybank.conf17
-rw-r--r--src/lib/testing_api_helpers_bank.c30
5 files changed, 60 insertions, 28 deletions
diff --git a/src/lib/test_bank_api.c b/src/lib/test_bank_api.c
index f47123975..d981a759c 100644
--- a/src/lib/test_bank_api.c
+++ b/src/lib/test_bank_api.c
@@ -33,7 +33,8 @@
#include <microhttpd.h>
#include "taler_testing_lib.h"
-#define CONFIG_FILE "test_bank_api.conf"
+#define CONFIG_FILE_FAKEBANK "test_bank_api_fakebank.conf"
+#define CONFIG_FILE_PYBANK "test_bank_api_pybank.conf"
/**
* Bank configuration data.
@@ -126,6 +127,7 @@ main (int argc,
char *const *argv)
{
int rv;
+ const char *cfgfilename;
/* These environment variables get in the way... */
unsetenv ("XDG_DATA_HOME");
@@ -138,8 +140,9 @@ main (int argc,
if (GNUNET_YES == with_fakebank)
{
TALER_LOG_DEBUG ("Running against the Fakebank.\n");
+ cfgfilename = CONFIG_FILE_FAKEBANK;
if (GNUNET_OK !=
- TALER_TESTING_prepare_fakebank (CONFIG_FILE,
+ TALER_TESTING_prepare_fakebank (CONFIG_FILE_FAKEBANK,
"account-2",
&bc))
{
@@ -150,15 +153,16 @@ main (int argc,
else
{
TALER_LOG_DEBUG ("Running against the Pybank.\n");
+ cfgfilename = CONFIG_FILE_PYBANK;
if (GNUNET_OK !=
- TALER_TESTING_prepare_bank (CONFIG_FILE,
+ TALER_TESTING_prepare_bank (CONFIG_FILE_PYBANK,
&bc))
{
GNUNET_break (0);
return 77;
}
- if (NULL == (bankd = TALER_TESTING_run_bank (CONFIG_FILE,
+ if (NULL == (bankd = TALER_TESTING_run_bank (CONFIG_FILE_PYBANK,
bc.bank_url)))
{
GNUNET_break (0);
@@ -168,7 +172,7 @@ main (int argc,
rv = (GNUNET_OK == TALER_TESTING_setup (&run,
NULL,
- CONFIG_FILE,
+ cfgfilename,
NULL,
GNUNET_NO)) ? 0 : 1;
if (GNUNET_NO == with_fakebank)
diff --git a/src/lib/test_bank_api.conf b/src/lib/test_bank_api.conf
deleted file mode 100644
index c5d55fa3e..000000000
--- a/src/lib/test_bank_api.conf
+++ /dev/null
@@ -1,10 +0,0 @@
-[taler]
-currency = KUDOS
-
-[account-2]
-URL = payto://x-taler-bank/localhost/2
-
-[bank]
-SERVE = http
-HTTP_PORT = 8081
-DATABASE = postgres:///talercheck
diff --git a/src/lib/test_bank_api_fakebank.conf b/src/lib/test_bank_api_fakebank.conf
new file mode 100644
index 000000000..5c9e5e3a5
--- /dev/null
+++ b/src/lib/test_bank_api_fakebank.conf
@@ -0,0 +1,17 @@
+# This file is in the public domain.
+
+[taler]
+currency = KUDOS
+
+[account-2]
+URL = payto://x-taler-bank/localhost/2
+METHOD = x-taler-bank
+WIRE_GATEWAY_URL = "http://localhost:8081/2/"
+WIRE_GATEWAY_AUTH_METHOD = basic
+USERNAME = Exchange
+PASSWORD = x
+
+[bank]
+SERVE = http
+HTTP_PORT = 8081
+DATABASE = postgres:///talercheck
diff --git a/src/lib/test_bank_api_pybank.conf b/src/lib/test_bank_api_pybank.conf
new file mode 100644
index 000000000..5c9e5e3a5
--- /dev/null
+++ b/src/lib/test_bank_api_pybank.conf
@@ -0,0 +1,17 @@
+# This file is in the public domain.
+
+[taler]
+currency = KUDOS
+
+[account-2]
+URL = payto://x-taler-bank/localhost/2
+METHOD = x-taler-bank
+WIRE_GATEWAY_URL = "http://localhost:8081/2/"
+WIRE_GATEWAY_AUTH_METHOD = basic
+USERNAME = Exchange
+PASSWORD = x
+
+[bank]
+SERVE = http
+HTTP_PORT = 8081
+DATABASE = postgres:///talercheck
diff --git a/src/lib/testing_api_helpers_bank.c b/src/lib/testing_api_helpers_bank.c
index c3dd97639..e69952565 100644
--- a/src/lib/testing_api_helpers_bank.c
+++ b/src/lib/testing_api_helpers_bank.c
@@ -187,7 +187,7 @@ TALER_TESTING_run_bank (const char *config_filename,
/* give child time to start and bind against the socket */
fprintf (stderr,
- "Waiting for `taler-bank-manage' to be ready");
+ "Waiting for `taler-bank-manage' to be ready (via %s)\n", wget_cmd);
iter = 0;
do
{
@@ -348,17 +348,21 @@ TALER_TESTING_prepare_bank (const char *config_filename,
return GNUNET_SYSERR;
}
GNUNET_CONFIGURATION_destroy (cfg);
- GNUNET_asprintf (&bc->bank_url,
- "http://localhost:%llu/",
- port);
- GNUNET_asprintf (&bc->exchange_account_url,
- "%s%s",
- bc->bank_url,
- EXCHANGE_ACCOUNT_NAME);
- bc->exchange_payto = TALER_payto_xtalerbank_make (bc->bank_url,
- EXCHANGE_ACCOUNT_NAME);
- bc->user42_payto = TALER_payto_xtalerbank_make (bc->bank_url, "42");
- bc->user43_payto = TALER_payto_xtalerbank_make (bc->bank_url, "43");
+ bc->bank_url = GNUNET_strdup (bc->exchange_auth.wire_gateway_url);
+ bc->exchange_account_url = GNUNET_strdup (bc->exchange_auth.wire_gateway_url);
+ bc->exchange_payto = "payto://x-taler-bank/localhost/2";
+ bc->user42_payto = "payto://x-taler-bank/localhost/42";
+ bc->user43_payto = "payto://x-taler-bank/localhost/43";
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Using pybank %s on port %u\n",
+ bc->exchange_auth.wire_gateway_url,
+ (unsigned int) port);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "exchange payto: %s\n",
+ bc->exchange_payto);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "user42_payto: %s\n",
+ bc->user42_payto);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "user42_payto: %s\n",
+ bc->user43_payto);
return GNUNET_OK;
}
@@ -413,7 +417,7 @@ TALER_TESTING_prepare_fakebank (const char *config_filename,
(unsigned int) fakebank_port);
GNUNET_CONFIGURATION_destroy (cfg);
- bc->bank_url = bc->exchange_auth.wire_gateway_url;
+ bc->bank_url = GNUNET_strdup (bc->exchange_auth.wire_gateway_url);
if (GNUNET_OK !=
TALER_TESTING_url_port_free (bc->bank_url))
{