summaryrefslogtreecommitdiff
path: root/src/lib/test_bank_api_twisted.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-01-13 00:27:48 +0100
committerChristian Grothoff <christian@grothoff.org>2020-01-13 00:27:48 +0100
commitd842c14f85352367d9e2d0c868b63e09c206100e (patch)
tree24f49bfc35a08a31c566aa15725065c35290cdf0 /src/lib/test_bank_api_twisted.c
parent6b0c121fc9818b4cce00bf4540c53cb79d968766 (diff)
downloadexchange-d842c14f85352367d9e2d0c868b63e09c206100e.tar.gz
exchange-d842c14f85352367d9e2d0c868b63e09c206100e.tar.bz2
exchange-d842c14f85352367d9e2d0c868b63e09c206100e.zip
refactor to make it easier to share init logic for test configurations
Diffstat (limited to 'src/lib/test_bank_api_twisted.c')
-rw-r--r--src/lib/test_bank_api_twisted.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/lib/test_bank_api_twisted.c b/src/lib/test_bank_api_twisted.c
index ad8fd71d4..632bf1cbd 100644
--- a/src/lib/test_bank_api_twisted.c
+++ b/src/lib/test_bank_api_twisted.c
@@ -33,7 +33,6 @@
#include "taler_fakebank_lib.h"
#include "taler_testing_lib.h"
#include <taler/taler_twister_testing_lib.h>
-#include "taler_testing_bank_lib.h"
#include <taler/taler_twister_service.h>
/**
@@ -48,6 +47,11 @@
static int with_fakebank;
/**
+ * Bank configuration data.
+ */
+static struct TALER_TESTING_BankConfiguration bc;
+
+/**
* (real) Twister URL. Used at startup time to check if it runs.
*/
static char *twister_url;
@@ -64,11 +68,6 @@ static char *twisted_account_url;
static struct TALER_BANK_AuthenticationData auth;
/**
- * URL of the bank.
- */
-static char *bank_url;
-
-/**
* Twister process.
*/
static struct GNUNET_OS_Process *twisterd;
@@ -112,7 +111,7 @@ run (void *cls,
if (GNUNET_YES == with_fakebank)
TALER_TESTING_run_with_fakebank (is,
commands,
- bank_url);
+ bc.bank_url);
else
TALER_TESTING_run (is,
commands);
@@ -164,9 +163,10 @@ main (int argc,
if (GNUNET_YES == with_fakebank)
{
TALER_LOG_DEBUG ("Running against the Fakebank.\n");
- if (NULL == (bank_url = TALER_TESTING_prepare_fakebank
- (CONFIG_FILE,
- "account-1")))
+ if (GNUNET_OK !=
+ TALER_TESTING_prepare_fakebank (CONFIG_FILE,
+ "account-1",
+ &bc))
{
GNUNET_break (0);
GNUNET_free (twister_url);
@@ -176,8 +176,9 @@ main (int argc,
else
{
TALER_LOG_DEBUG ("Running against the Pybank.\n");
- if (NULL == (bank_url = TALER_TESTING_prepare_bank
- (CONFIG_FILE)))
+ if (GNUNET_OK !=
+ TALER_TESTING_prepare_bank (CONFIG_FILE,
+ &bc))
{
GNUNET_break (0);
GNUNET_free (twister_url);
@@ -185,11 +186,10 @@ main (int argc,
}
if (NULL == (bankd = TALER_TESTING_run_bank (CONFIG_FILE,
- bank_url)))
+ bc.bank_url)))
{
GNUNET_break (0);
GNUNET_free (twister_url);
- GNUNET_free (bank_url);
return 77;
}
}
@@ -210,8 +210,6 @@ main (int argc,
}
GNUNET_free (twister_url);
- GNUNET_free (bank_url);
-
if (GNUNET_OK == ret)
return 0;