merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit 96939050ef7d6afe8f0d6ff5b68dbdd940c1c85e
parent d89d64100d97b8987521b35fc1d869b9cc65979c
Author: Marcello Stanisci <stanisci.m@gmail.com>
Date:   Thu,  3 May 2018 15:06:20 +0200

conditions in test code.

It is now possible to use a custom config file
and purge the test database only if certains symbols
are defined.  This is needed for the upcoming
payment generator, as it should never purge the
database it works on, and supposedly always use
the ~/.config/taler.conf default database.

Diffstat:
Msrc/lib/Makefile.am | 1+
Msrc/lib/testing_api_helpers.c | 15+++++++++++----
2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am @@ -127,6 +127,7 @@ test_merchant_api_new_LDADD = \ -lgnunetcurl \ -lgnunetutil \ -ljansson +test_merchant_api_new_CFLAGS = -DCUSTOM_CONFIG -DPURGE_DATABASE test_merchant_api_SOURCES = \ test_merchant_api.c diff --git a/src/lib/testing_api_helpers.c b/src/lib/testing_api_helpers.c @@ -74,7 +74,9 @@ TALER_TESTING_run_merchant (const char *config_filename) NULL, NULL, NULL, "taler-merchant-httpd", "taler-merchant-httpd", + #ifdef CUSTOM_CONFIG "-c", config_filename, + #endif NULL); if (NULL == merchant_proc) MERCHANT_FAIL (); @@ -126,9 +128,6 @@ TALER_TESTING_prepare_merchant (const char *config_filename) { struct GNUNET_CONFIGURATION_Handle *cfg; unsigned long long port; - struct GNUNET_OS_Process *dbinit_proc; - enum GNUNET_OS_ProcessStatusType type; - unsigned long code; char *base_url; cfg = GNUNET_CONFIGURATION_create (); @@ -161,6 +160,11 @@ TALER_TESTING_prepare_merchant (const char *config_filename) MERCHANT_FAIL (); } + #ifdef PURGE_DATABASE + struct GNUNET_OS_Process *dbinit_proc; + enum GNUNET_OS_ProcessStatusType type; + unsigned long code; + /* DB preparation */ if (NULL == (dbinit_proc = GNUNET_OS_start_process (GNUNET_NO, @@ -168,7 +172,9 @@ TALER_TESTING_prepare_merchant (const char *config_filename) NULL, NULL, NULL, "taler-merchant-dbinit", "taler-merchant-dbinit", + #ifdef CUSTOM_CONFIG "-c", config_filename, + #endif "-r", NULL))) { @@ -201,8 +207,9 @@ TALER_TESTING_prepare_merchant (const char *config_filename) " `taler-merchant-dbinit'!\n"); MERCHANT_FAIL (); } - GNUNET_OS_process_destroy (dbinit_proc); + GNUNET_OS_process_destroy (dbinit_proc); + #endif GNUNET_asprintf (&base_url,