aboutsummaryrefslogtreecommitdiff
path: root/src/testing/test_merchant_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-02-13 14:29:59 +0100
committerChristian Grothoff <christian@grothoff.org>2022-02-13 14:29:59 +0100
commit0e1b08bf358424d397ece4e277e67d508ff73247 (patch)
treebe2da24707f75256f868af8185dc99defc86baf6 /src/testing/test_merchant_api.c
parentea48f7b894581d67367ba184e969dede7f9ad603 (diff)
downloadmerchant-0e1b08bf358424d397ece4e277e67d508ff73247.tar.gz
merchant-0e1b08bf358424d397ece4e277e67d508ff73247.tar.bz2
merchant-0e1b08bf358424d397ece4e277e67d508ff73247.zip
-migrate merchant tests to support RSA and CS
Diffstat (limited to 'src/testing/test_merchant_api.c')
-rw-r--r--src/testing/test_merchant_api.c44
1 files changed, 26 insertions, 18 deletions
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c
index 9892732d..5e746e12 100644
--- a/src/testing/test_merchant_api.c
+++ b/src/testing/test_merchant_api.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2014-2021 Taler Systems SA
+ Copyright (C) 2014-2022 Taler Systems SA
TALER is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -29,6 +29,7 @@
#include <taler/taler_exchange_service.h>
#include <taler/taler_json_lib.h>
#include <gnunet/gnunet_util_lib.h>
+#include <gnunet/gnunet_testing_lib.h>
#include <microhttpd.h>
#include <taler/taler_bank_service.h>
#include <taler/taler_fakebank_lib.h>
@@ -56,7 +57,7 @@
* Configuration file we use. One (big) configuration is used
* for the various components for this test.
*/
-#define CONFIG_FILE "test_merchant_api.conf"
+static char *config_file;
#define PAYTO_I1 "payto://x-taler-bank/localhost/3"
@@ -171,7 +172,7 @@ const char *order_1_forgets_3[] = {
static struct TALER_TESTING_Command
cmd_exec_wirewatch (const char *label)
{
- return TALER_TESTING_cmd_exec_wirewatch (label, CONFIG_FILE);
+ return TALER_TESTING_cmd_exec_wirewatch (label, config_file);
}
@@ -182,8 +183,8 @@ cmd_exec_wirewatch (const char *label)
* @param label label to use for the command.
*/
#define CMD_EXEC_AGGREGATOR(label) \
- TALER_TESTING_cmd_exec_aggregator (label "-aggregator", CONFIG_FILE), \
- TALER_TESTING_cmd_exec_transfer (label "-transfer", CONFIG_FILE)
+ TALER_TESTING_cmd_exec_aggregator (label "-aggregator", config_file), \
+ TALER_TESTING_cmd_exec_transfer (label "-transfer", config_file)
/**
@@ -1274,9 +1275,9 @@ run (void *cls,
MHD_HTTP_NO_CONTENT,
false),
TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys",
- CONFIG_FILE),
+ config_file),
TALER_TESTING_cmd_exec_offline_sign_fees ("offline-sign-fees",
- CONFIG_FILE,
+ config_file,
"EUR:0.01",
"EUR:0.01"),
TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys",
@@ -1630,17 +1631,26 @@ int
main (int argc,
char *const *argv)
{
+ char *cipher;
unsigned int ret;
+
/* These environment variables get in the way... */
unsetenv ("XDG_DATA_HOME");
unsetenv ("XDG_CONFIG_HOME");
- GNUNET_log_setup ("test-merchant-api",
+ GNUNET_log_setup (argv[0],
"DEBUG",
NULL);
- if (GNUNET_OK != TALER_TESTING_prepare_fakebank (CONFIG_FILE,
- "exchange-account-exchange",
- &bc))
+ cipher = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
+ GNUNET_assert (NULL != cipher);
+ GNUNET_asprintf (&config_file,
+ "test_merchant_api-%s.conf",
+ cipher);
+ GNUNET_free (cipher);
+ if (GNUNET_OK !=
+ TALER_TESTING_prepare_fakebank (config_file,
+ "exchange-account-exchange",
+ &bc))
return 77;
payer_payto = ("payto://x-taler-bank/localhost/" USER_ACCOUNT_NAME);
@@ -1648,15 +1658,15 @@ main (int argc,
merchant_payto = ("payto://x-taler-bank/localhost/" MERCHANT_ACCOUNT_NAME);
if (NULL ==
- (merchant_url = TALER_TESTING_prepare_merchant (CONFIG_FILE)))
+ (merchant_url = TALER_TESTING_prepare_merchant (config_file)))
return 77;
GNUNET_asprintf (&merchant_url_i1a,
"%sinstances/i1a/",
merchant_url);
- TALER_TESTING_cleanup_files (CONFIG_FILE);
+ TALER_TESTING_cleanup_files (config_file);
- switch (TALER_TESTING_prepare_exchange (CONFIG_FILE,
+ switch (TALER_TESTING_prepare_exchange (config_file,
GNUNET_YES,
&ec))
{
@@ -1665,17 +1675,15 @@ main (int argc,
return 1;
case GNUNET_NO:
return 77;
-
case GNUNET_OK:
-
if (NULL == (merchantd =
- TALER_TESTING_run_merchant (CONFIG_FILE,
+ TALER_TESTING_run_merchant (config_file,
merchant_url)))
return 1;
ret = TALER_TESTING_setup_with_exchange (&run,
NULL,
- CONFIG_FILE);
+ config_file);
GNUNET_OS_process_kill (merchantd, SIGTERM);
GNUNET_OS_process_wait (merchantd);