diff options
| author | Christian Grothoff <christian@grothoff.org> | 2020-01-13 00:27:48 +0100 | 
|---|---|---|
| committer | Christian Grothoff <christian@grothoff.org> | 2020-01-13 00:27:48 +0100 | 
| commit | d842c14f85352367d9e2d0c868b63e09c206100e (patch) | |
| tree | 24f49bfc35a08a31c566aa15725065c35290cdf0 /src/lib | |
| parent | 6b0c121fc9818b4cce00bf4540c53cb79d968766 (diff) | |
refactor to make it easier to share init logic for test configurations
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/test_auditor_api.c | 205 | ||||
| -rw-r--r-- | src/lib/test_bank_api.c | 84 | ||||
| -rw-r--r-- | src/lib/test_bank_api_twisted.c | 30 | ||||
| -rw-r--r-- | src/lib/test_exchange_api.c | 187 | ||||
| -rw-r--r-- | src/lib/test_exchange_api_keys_cherry_picking.c | 14 | ||||
| -rw-r--r-- | src/lib/test_exchange_api_overlapping_keys_bug.c | 12 | ||||
| -rw-r--r-- | src/lib/test_exchange_api_twisted.c | 69 | ||||
| -rw-r--r-- | src/lib/testing_api_cmd_bank_admin_add_incoming.c | 1 | ||||
| -rw-r--r-- | src/lib/testing_api_cmd_bank_history_credit.c | 1 | ||||
| -rw-r--r-- | src/lib/testing_api_cmd_bank_history_debit.c | 3 | ||||
| -rw-r--r-- | src/lib/testing_api_cmd_bank_transfer.c | 1 | ||||
| -rw-r--r-- | src/lib/testing_api_cmd_deposit.c | 6 | ||||
| -rw-r--r-- | src/lib/testing_api_helpers_bank.c | 207 | ||||
| -rw-r--r-- | src/lib/testing_api_helpers_exchange.c | 189 | 
14 files changed, 396 insertions, 613 deletions
| diff --git a/src/lib/test_auditor_api.c b/src/lib/test_auditor_api.c index 53a48a2a..eb381349 100644 --- a/src/lib/test_auditor_api.c +++ b/src/lib/test_auditor_api.c @@ -33,7 +33,6 @@  #include <microhttpd.h>  #include "taler_bank_service.h"  #include "taler_fakebank_lib.h" -#include "taler_testing_bank_lib.h"  #include "taler_testing_lib.h"  #include "taler_testing_auditor_lib.h" @@ -47,55 +46,14 @@    "test_auditor_api_expire_reserve_now.conf"  /** - * URL of the fakebank.  Obtained from CONFIG_FILE's - * "exchange-wire-test:BANK_URI" option. + * Exchange configuration data.   */ -static char *fakebank_url; +static struct TALER_TESTING_ExchangeConfiguration ec;  /** - * Auditor base URL as it appears in the configuration.  Note - * that it might differ from the one where the exchange actually - * listens from. + * Bank configuration data.   */ -static char *auditor_url; - -/** - * Exchange base URL as it appears in the configuration.  Note - * that it might differ from the one where the exchange actually - * listens from. - */ -static char *exchange_url; - -/** - * URL of the exchange's account at the bank.  Obtained from CONFIG_FILE's - * "exchange-wire-test:BANK_URI" option plus the exchange account. - */ -static char *exchange_account_url; // FIXME: initialize! - -/** - * Account number of the exchange at the bank. - */ -#define EXCHANGE_ACCOUNT_NO "2" // FIXME: used? - -/** - * Payto URL of the user's account. - */ -static char *user_account_payto; // FIXME: initialize! - -/** - * Payto URL of the user's account. - */ -static char *user2_account_payto; // FIXME: initialize! (43!) - -/** - * Payto URL of the exchange's account. - */ -static char *exchange_account_payto; // FIXME: initialize! - -/** - * Credentials for talking to the bank. - */ -static struct TALER_BANK_AuthenticationData auth; // FIXME: initialize! +static struct TALER_TESTING_BankConfiguration bc;  /**   * Execute the taler-exchange-wirewatch command with @@ -123,10 +81,10 @@ static struct TALER_BANK_AuthenticationData auth; // FIXME: initialize!   * @param amount amount to transfer, i.e. "EUR:1"   */  #define CMD_TRANSFER_TO_EXCHANGE(label,amount) \ -  TALER_TESTING_cmd_admin_add_incoming (label, amount, \ -                                        exchange_account_url, \ -                                        &auth, \ -                                        user_account_payto) +  TALER_TESTING_cmd_admin_add_incoming (label, amount,           \ +                                        bc.exchange_account_url, \ +                                        &bc.exchange_auth,       \ +                                        bc.user42_payto)  /**   * Run the taler-auditor. @@ -186,8 +144,7 @@ run (void *cls,      TALER_TESTING_cmd_deposit ("deposit-simple",                                 "withdraw-coin-1",                                 0, -                               TALER_TESTING_make_wire_details (42, -                                                                fakebank_url), +                               bc.user42_payto,                                 "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",                                 GNUNET_TIME_UNIT_ZERO,                                 "EUR:5", @@ -221,8 +178,7 @@ run (void *cls,      TALER_TESTING_cmd_deposit ("refresh-deposit-partial",                                 "refresh-withdraw-coin-1",                                 0, -                               TALER_TESTING_make_wire_details (42, -                                                                fakebank_url), +                               bc.user42_payto,                                 "{\"items\":[{\"name\":\"ice\",\"value\":\"EUR:1\"}]}",                                 GNUNET_TIME_UNIT_ZERO,                                 "EUR:1", @@ -246,8 +202,7 @@ run (void *cls,      TALER_TESTING_cmd_deposit ("refresh-deposit-refreshed-1b",                                 "refresh-reveal-1",                                 3, -                               TALER_TESTING_make_wire_details (43, -                                                                fakebank_url), +                               bc.user43_payto,                                 "{\"items\":[{\"name\":\"ice cream\",\"value\":3}]}",                                 GNUNET_TIME_UNIT_ZERO,                                 "EUR:0.1", @@ -268,78 +223,78 @@ run (void *cls,       * Check all the transfers took place.       */      TALER_TESTING_cmd_check_bank_transfer -      ("check_bank_transfer-499c", exchange_url, -      "EUR:4.98", exchange_account_payto, user_account_payto), +      ("check_bank_transfer-499c", ec.exchange_url, +      "EUR:4.98", bc.exchange_payto, bc.user42_payto),      TALER_TESTING_cmd_check_bank_transfer -      ("check_bank_transfer-99c1", exchange_url, -      "EUR:0.98", exchange_account_payto, user_account_payto), +      ("check_bank_transfer-99c1", ec.exchange_url, +      "EUR:0.98", bc.exchange_payto, bc.user42_payto),      TALER_TESTING_cmd_check_bank_transfer -      ("check_bank_transfer-99c", exchange_url, -      "EUR:0.08", exchange_account_payto, user2_account_payto), +      ("check_bank_transfer-99c", ec.exchange_url, +      "EUR:0.08", bc.exchange_payto, bc.user43_payto),      TALER_TESTING_cmd_check_bank_transfer -      ("check_bank_transfer-aai-1", exchange_url, -      "EUR:5.01", user_account_payto, exchange_account_payto), +      ("check_bank_transfer-aai-1", ec.exchange_url, +      "EUR:5.01", bc.user42_payto, bc.exchange_payto),      TALER_TESTING_cmd_check_bank_transfer -      ("check_bank_transfer-aai-2", exchange_url, -      "EUR:5.01", user_account_payto, exchange_account_payto), +      ("check_bank_transfer-aai-2", ec.exchange_url, +      "EUR:5.01", bc.user42_payto, bc.exchange_payto),      /* The following transactions got originated within       * the "massive deposit confirms" batch.  */      TALER_TESTING_cmd_check_bank_transfer        ("check-massive-transfer", -      exchange_url, +      ec.exchange_url,        "EUR:10.10", -      user_account_payto, exchange_account_payto), +      bc.user42_payto, bc.exchange_payto),      TALER_TESTING_cmd_check_bank_transfer        ("check-massive-transfer-1", -      exchange_url, +      ec.exchange_url,        "EUR:0.98", -      exchange_account_payto, user2_account_payto), +      bc.exchange_payto, bc.user43_payto),      TALER_TESTING_cmd_check_bank_transfer        ("check-massive-transfer-2", -      exchange_url, +      ec.exchange_url,        "EUR:0.98", -      exchange_account_payto, user2_account_payto), +      bc.exchange_payto, bc.user43_payto),      TALER_TESTING_cmd_check_bank_transfer        ("check-massive-transfer-3", -      exchange_url, +      ec.exchange_url,        "EUR:0.98", -      exchange_account_payto, user2_account_payto), +      bc.exchange_payto, bc.user43_payto),      TALER_TESTING_cmd_check_bank_transfer        ("check-massive-transfer-4", -      exchange_url, +      ec.exchange_url,        "EUR:0.98", -      exchange_account_payto, user2_account_payto), +      bc.exchange_payto, bc.user43_payto),      TALER_TESTING_cmd_check_bank_transfer        ("check-massive-transfer-5", -      exchange_url, +      ec.exchange_url,        "EUR:0.98", -      exchange_account_payto, user2_account_payto), +      bc.exchange_payto, bc.user43_payto),      TALER_TESTING_cmd_check_bank_transfer        ("check-massive-transfer-6", -      exchange_url, +      ec.exchange_url,        "EUR:0.98", -      exchange_account_payto, user2_account_payto), +      bc.exchange_payto, bc.user43_payto),      TALER_TESTING_cmd_check_bank_transfer        ("check-massive-transfer-7", -      exchange_url, +      ec.exchange_url,        "EUR:0.98", -      exchange_account_payto, user2_account_payto), +      bc.exchange_payto, bc.user43_payto),      TALER_TESTING_cmd_check_bank_transfer        ("check-massive-transfer-8", -      exchange_url, +      ec.exchange_url,        "EUR:0.98", -      exchange_account_payto, user2_account_payto), +      bc.exchange_payto, bc.user43_payto),      TALER_TESTING_cmd_check_bank_transfer        ("check-massive-transfer-9", -      exchange_url, +      ec.exchange_url,        "EUR:0.98", -      exchange_account_payto, user2_account_payto), +      bc.exchange_payto, bc.user43_payto),      TALER_TESTING_cmd_check_bank_transfer        ("check-massive-transfer-10", -      exchange_url, +      ec.exchange_url,        "EUR:0.98", -      exchange_account_payto, user2_account_payto), +      bc.exchange_payto, bc.user43_payto),      TALER_TESTING_cmd_check_bank_empty ("check_bank_empty"),      TALER_TESTING_cmd_end ()    }; @@ -355,10 +310,10 @@ run (void *cls,      CMD_EXEC_WIREWATCH ("wirewatch-unaggregated"),      /* "consume" reserve creation transfer.  */      TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-unaggregated", -                                           exchange_url, +                                           ec.exchange_url,                                             "EUR:5.01", -                                           user_account_payto, -                                           exchange_account_payto), +                                           bc.user42_payto, +                                           bc.exchange_payto),      TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-unaggregated",                                         "create-reserve-unaggregated",                                         "EUR:5", @@ -366,9 +321,7 @@ run (void *cls,      TALER_TESTING_cmd_deposit ("deposit-unaggregated",                                 "withdraw-coin-unaggregated",                                 0, -                               TALER_TESTING_make_wire_details -                                 (43, -                                 fakebank_url), +                               bc.user43_payto,                                 "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",                                 GNUNET_TIME_relative_multiply                                   (GNUNET_TIME_UNIT_YEARS, @@ -404,8 +357,7 @@ run (void *cls,      TALER_TESTING_cmd_deposit ("deposit-refund-1",                                 "withdraw-coin-r1",                                 0, -                               TALER_TESTING_make_wire_details (42, -                                                                fakebank_url), +                               bc.user42_payto,                                 "{\"items\":[{\"name\":\"ice\",\"value\":\"EUR:5\"}]}",                                 GNUNET_TIME_UNIT_MINUTES,                                 "EUR:5", @@ -423,8 +375,7 @@ run (void *cls,      TALER_TESTING_cmd_deposit ("deposit-refund-2",                                 "withdraw-coin-r1",                                 0, -                               TALER_TESTING_make_wire_details (42, -                                                                fakebank_url), +                               bc.user42_payto,                                 "{\"items\":[{\"name\":\"more\",\"value\":\"EUR:5\"}]}",                                 GNUNET_TIME_UNIT_ZERO,                                 "EUR:4.99", @@ -510,8 +461,7 @@ run (void *cls,      TALER_TESTING_cmd_deposit ("payback-deposit-partial",                                 "payback-withdraw-coin-2a",                                 0, -                               TALER_TESTING_make_wire_details (42, -                                                                fakebank_url), +                               bc.user42_payto,                                 "{\"items\":[{\"name\":\"more ice cream\",\"value\":1}]}",                                 GNUNET_TIME_UNIT_ZERO,                                 "EUR:0.5", @@ -581,9 +531,7 @@ run (void *cls,        ("massive-deposit-1",        "massive-withdraw-1",        0, -      TALER_TESTING_make_wire_details -        (43, -        fakebank_url), +      bc.user43_payto,        "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",        GNUNET_TIME_UNIT_ZERO,        "EUR:1", @@ -592,9 +540,7 @@ run (void *cls,        ("massive-deposit-2",        "massive-withdraw-2",        0, -      TALER_TESTING_make_wire_details -        (43, -        fakebank_url), +      bc.user43_payto,        "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",        GNUNET_TIME_UNIT_ZERO,        "EUR:1", @@ -603,9 +549,7 @@ run (void *cls,        ("massive-deposit-3",        "massive-withdraw-3",        0, -      TALER_TESTING_make_wire_details -        (43, -        fakebank_url), +      bc.user43_payto,        "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",        GNUNET_TIME_UNIT_ZERO,        "EUR:1", @@ -614,9 +558,7 @@ run (void *cls,        ("massive-deposit-4",        "massive-withdraw-4",        0, -      TALER_TESTING_make_wire_details -        (43, -        fakebank_url), +      bc.user43_payto,        "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",        GNUNET_TIME_UNIT_ZERO,        "EUR:1", @@ -625,9 +567,7 @@ run (void *cls,        ("massive-deposit-5",        "massive-withdraw-5",        0, -      TALER_TESTING_make_wire_details -        (43, -        fakebank_url), +      bc.user43_payto,        "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",        GNUNET_TIME_UNIT_ZERO,        "EUR:1", @@ -636,9 +576,7 @@ run (void *cls,        ("massive-deposit-6",        "massive-withdraw-6",        0, -      TALER_TESTING_make_wire_details -        (43, -        fakebank_url), +      bc.user43_payto,        "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",        GNUNET_TIME_UNIT_ZERO,        "EUR:1", @@ -647,9 +585,7 @@ run (void *cls,        ("massive-deposit-7",        "massive-withdraw-7",        0, -      TALER_TESTING_make_wire_details -        (43, -        fakebank_url), +      bc.user43_payto,        "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",        GNUNET_TIME_UNIT_ZERO,        "EUR:1", @@ -658,9 +594,7 @@ run (void *cls,        ("massive-deposit-8",        "massive-withdraw-8",        0, -      TALER_TESTING_make_wire_details -        (43, -        fakebank_url), +      bc.user43_payto,        "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",        GNUNET_TIME_UNIT_ZERO,        "EUR:1", @@ -669,9 +603,7 @@ run (void *cls,        ("massive-deposit-9",        "massive-withdraw-9",        0, -      TALER_TESTING_make_wire_details -        (43, -        fakebank_url), +      bc.user43_payto,        "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",        GNUNET_TIME_UNIT_ZERO,        "EUR:1", @@ -680,9 +612,7 @@ run (void *cls,        ("massive-deposit-10",        "massive-withdraw-10",        0, -      TALER_TESTING_make_wire_details -        (43, -        fakebank_url), +      bc.user43_payto,        "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",        GNUNET_TIME_UNIT_ZERO,        "EUR:1", @@ -727,7 +657,7 @@ run (void *cls,    TALER_TESTING_run_with_fakebank (is,                                     commands, -                                   fakebank_url); +                                   bc.bank_url);  } @@ -741,19 +671,18 @@ main (int argc,    GNUNET_log_setup ("test-auditor-api",                      "INFO",                      NULL); -  if (NULL == (fakebank_url -               /* Check fakebank port is available and config cares -                * about bank url. */ -                 = TALER_TESTING_prepare_fakebank (CONFIG_FILE, -                                                   "account-2"))) +  /* Check fakebank port is available and get configuration data. */ +  if (GNUNET_OK != +      TALER_TESTING_prepare_fakebank (CONFIG_FILE, +                                      "account-2", +                                      &bc))      return 77;    TALER_TESTING_cleanup_files (CONFIG_FILE);    /* @helpers.  Run keyup, create tables, ... Note: it     * fetches the port number from config in order to see     * if it's available. */    switch (TALER_TESTING_prepare_exchange (CONFIG_FILE, -                                          &auditor_url, -                                          &exchange_url)) +                                          &ec))    {    case GNUNET_SYSERR:      GNUNET_break (0); diff --git a/src/lib/test_bank_api.c b/src/lib/test_bank_api.c index bb62aead..9e723659 100644 --- a/src/lib/test_bank_api.c +++ b/src/lib/test_bank_api.c @@ -32,25 +32,14 @@  #include <gnunet/gnunet_curl_lib.h>  #include <microhttpd.h>  #include "taler_testing_lib.h" -#include "taler_testing_bank_lib.h" - +// FIXME: rename config file to make it clear it is associated with a test!  #define CONFIG_FILE "bank.conf"  /** - * Fakebank URL. - */ -static char *bank_url; - -/** - * Account URL. - */ -static char *account_url; - -/** - * payto://-URL of another account. + * Bank configuration data.   */ -static char *payto_url; +static struct TALER_TESTING_BankConfiguration bc;  /**   * Handle to the Py-bank daemon. @@ -58,11 +47,6 @@ static char *payto_url;  static struct GNUNET_OS_Process *bankd;  /** - * Authentication data to use. - */ -static struct TALER_BANK_AuthenticationData auth; - -/**   * Flag indicating whether the test is running against the   * Fakebank.  Set up at runtime.   */ @@ -81,40 +65,40 @@ run (void *cls,    struct TALER_WireTransferIdentifierRawP wtid;    struct TALER_TESTING_Command commands[] = {      TALER_TESTING_cmd_bank_credits ("history-0", -                                    account_url, -                                    &auth, +                                    bc.exchange_account_url, +                                    &bc.exchange_auth,                                      NULL,                                      1),      TALER_TESTING_cmd_admin_add_incoming ("debit-1",                                            "KUDOS:5.01", -                                          account_url, -                                          &auth, -                                          payto_url), +                                          bc.exchange_account_url, +                                          &bc.exchange_auth, +                                          bc.user42_payto),      TALER_TESTING_cmd_bank_credits ("history-1c", -                                    account_url, -                                    &auth, +                                    bc.exchange_account_url, +                                    &bc.exchange_auth,                                      NULL,                                      5),      TALER_TESTING_cmd_bank_debits ("history-1d", -                                   account_url, -                                   &auth, +                                   bc.exchange_account_url, +                                   &bc.exchange_auth,                                     NULL,                                     5),      TALER_TESTING_cmd_admin_add_incoming ("debit-2",                                            "KUDOS:3.21", -                                          account_url, -                                          &auth, -                                          payto_url), +                                          bc.exchange_account_url, +                                          &bc.exchange_auth, +                                          bc.user42_payto),      TALER_TESTING_cmd_transfer ("credit-2",                                  "KUDOS:3.22", -                                account_url, -                                &auth, -                                payto_url, +                                bc.exchange_account_url, +                                &bc.exchange_auth, +                                bc.user42_payto,                                  &wtid,                                  "http://exchange.example.com/"),      TALER_TESTING_cmd_bank_debits ("history-2b", -                                   account_url, -                                   &auth, +                                   bc.exchange_account_url, +                                   &bc.exchange_auth,                                     NULL,                                     5),      TALER_TESTING_cmd_end () @@ -123,20 +107,11 @@ run (void *cls,    memset (&wtid, 42, sizeof (wtid));    GNUNET_log (GNUNET_ERROR_TYPE_INFO,                "Bank serves at `%s'\n", -              bank_url); -  GNUNET_asprintf (&account_url, -                   "%s/%s", -                   bank_url, -                   "alice"); -  GNUNET_asprintf (&payto_url, -                   "payto://x-taler-bank/%s/%s", -                   bank_url, -                   "bob"); -  // FIXME: init 'auth'! +              bc.bank_url);    if (GNUNET_YES == with_fakebank)      TALER_TESTING_run_with_fakebank (is,                                       commands, -                                     bank_url); +                                     bc.bank_url);    else      TALER_TESTING_run (is,                         commands); @@ -155,14 +130,15 @@ main (int argc,    GNUNET_log_setup ("test-bank-api",                      "DEBUG",                      NULL); -    with_fakebank = TALER_TESTING_has_in_name (argv[0],                                               "_with_fakebank");    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);        return 77; @@ -171,14 +147,16 @@ 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);        return 77;      }      if (NULL == (bankd = TALER_TESTING_run_bank (CONFIG_FILE, -                                                 bank_url))) +                                                 bc.bank_url)))      {        GNUNET_break (0);        return 77; @@ -197,9 +175,7 @@ main (int argc,                              SIGKILL);      GNUNET_OS_process_wait (bankd);      GNUNET_OS_process_destroy (bankd); -    GNUNET_free (bank_url);    } -    return rv;  } diff --git a/src/lib/test_bank_api_twisted.c b/src/lib/test_bank_api_twisted.c index ad8fd71d..632bf1cb 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; diff --git a/src/lib/test_exchange_api.c b/src/lib/test_exchange_api.c index 4f903414..81e54a98 100644 --- a/src/lib/test_exchange_api.c +++ b/src/lib/test_exchange_api.c @@ -1,6 +1,6 @@  /*    This file is part of TALER -  Copyright (C) 2014--2019 Taler Systems SA +  Copyright (C) 2014--2020 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 @@ -16,15 +16,13 @@    License along with TALER; see the file COPYING.  If not, see    <http://www.gnu.org/licenses/>  */ -  /** - * @file exchange/test_exchange_api.c + * @file lib/test_exchange_api.c   * @brief testcase to test exchange's HTTP API interface   * @author Sree Harsha Totakura <sreeharsha@totakura.in>   * @author Christian Grothoff   * @author Marcello Stanisci   */ -  #include "platform.h"  #include "taler_util.h"  #include "taler_signatures.h" @@ -35,7 +33,6 @@  #include "taler_bank_service.h"  #include "taler_fakebank_lib.h"  #include "taler_testing_lib.h" -#include "taler_testing_bank_lib.h"  /**   * Configuration file we use.  One (big) configuration is used @@ -46,56 +43,16 @@  #define CONFIG_FILE_EXPIRE_RESERVE_NOW \    "test_exchange_api_expire_reserve_now.conf" -/** - * URL of the fakebank.  Obtained from CONFIG_FILE's - * "exchange-wire-test:BANK_URI" option. - */ -static char *fakebank_url; - -/** - * Exchange base URL as it appears in the configuration.  Note - * that it might differ from the one where the exchange actually - * listens from. - */ -static char *exchange_url; - -/** - * Auditor base URL as it appears in the configuration.  Note - * that it might differ from the one where the auditor actually - * listens from. - */ -static char *auditor_url; - -/** - * URL of the exchange's account at the bank.  Obtained from CONFIG_FILE's - * "exchange-wire-test:BANK_URI" option plus the exchange account. - */ -static char *exchange_account_url; // FIXME: initialize! - -/** - * Account number of the exchange at the bank. - */ -#define EXCHANGE_ACCOUNT_NO "2" // FIXME: used? - -/** - * Payto URL of the user's account. - */ -static char *user_account_payto; // FIXME: initialize! - -/** - * Payto URL of the user's account. - */ -static char *user2_account_payto; // FIXME: initialize! (43!)  /** - * Payto URL of the exchange's account. + * Exchange configuration data.   */ -static char *exchange_account_payto; // FIXME: initialize! +static struct TALER_TESTING_ExchangeConfiguration ec;  /** - * Credentials for talking to the bank. + * Bank configuration data.   */ -static struct TALER_BANK_AuthenticationData auth; // FIXME: initialize! +static struct TALER_TESTING_BankConfiguration bc;  /** @@ -125,9 +82,9 @@ static struct TALER_BANK_AuthenticationData auth; // FIXME: initialize!   */  #define CMD_TRANSFER_TO_EXCHANGE(label,amount) \    TALER_TESTING_cmd_admin_add_incoming (label, amount, \ -                                        exchange_account_url, \ -                                        &auth, \ -                                        user_account_payto) +                                        bc.exchange_account_url,           \ +                                        &bc.exchange_auth,                \ +                                        bc.user42_payto)  /**   * Main function that will tell the interpreter what commands to @@ -197,8 +154,7 @@ run (void *cls,       */      TALER_TESTING_cmd_deposit        ("deposit-simple", "withdraw-coin-1", 0, -      TALER_TESTING_make_wire_details (42, -                                       fakebank_url), +      bc.user42_payto,        "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",        GNUNET_TIME_UNIT_ZERO, "EUR:5", MHD_HTTP_OK), @@ -215,8 +171,7 @@ run (void *cls,       */      TALER_TESTING_cmd_deposit        ("deposit-double-1", "withdraw-coin-1", 0, -      TALER_TESTING_make_wire_details (43, -                                       fakebank_url), +      bc.user43_payto,        "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",        GNUNET_TIME_UNIT_ZERO, "EUR:5", MHD_HTTP_CONFLICT), @@ -230,8 +185,7 @@ run (void *cls,       * how can a different id be generated?       */TALER_TESTING_cmd_deposit        ("deposit-double-1", "withdraw-coin-1", 0, -      TALER_TESTING_make_wire_details (43, -                                       fakebank_url), +      bc.user43_payto,        "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",        GNUNET_TIME_UNIT_ZERO, "EUR:5", MHD_HTTP_CONFLICT), @@ -240,8 +194,7 @@ run (void *cls,       */      TALER_TESTING_cmd_deposit        ("deposit-double-2", "withdraw-coin-1", 0, -      TALER_TESTING_make_wire_details (43, -                                       fakebank_url), +      bc.user43_payto,        "{\"items\":[{\"name\":\"ice cream\",\"value\":2}]}",        GNUNET_TIME_UNIT_ZERO, "EUR:5", MHD_HTTP_CONFLICT), @@ -279,8 +232,7 @@ run (void *cls,       */TALER_TESTING_cmd_deposit        ("refresh-deposit-partial",        "refresh-withdraw-coin-1", 0, -      TALER_TESTING_make_wire_details (42, -                                       fakebank_url), +      bc.user42_payto,        "{\"items\":[{\"name\":\"ice cream\",\                       \"value\":\"EUR:1\"}]}",        GNUNET_TIME_UNIT_ZERO, "EUR:1", MHD_HTTP_OK), @@ -321,8 +273,7 @@ run (void *cls,      TALER_TESTING_cmd_deposit        ("refresh-deposit-refreshed-1a",        "refresh-reveal-1-idempotency", 0, -      TALER_TESTING_make_wire_details (42, -                                       fakebank_url), +      bc.user42_payto,        "{\"items\":[{\"name\":\"ice cream\",\                       \"value\":3}]}",        GNUNET_TIME_UNIT_ZERO, "EUR:1", MHD_HTTP_OK), @@ -333,8 +284,7 @@ run (void *cls,      TALER_TESTING_cmd_deposit        ("refresh-deposit-refreshed-1b",        "refresh-reveal-1", 3, -      TALER_TESTING_make_wire_details (43, -                                       fakebank_url), +      bc.user43_payto,        "{\"items\":[{\"name\":\"ice cream\",\                       \"value\":3}]}",        GNUNET_TIME_UNIT_ZERO, "EUR:0.1", MHD_HTTP_OK), @@ -390,32 +340,32 @@ run (void *cls,       * Check all the transfers took place.       */      TALER_TESTING_cmd_check_bank_transfer -      ("check_bank_transfer-499c", exchange_url, -      "EUR:4.98", exchange_account_payto, user_account_payto), +      ("check_bank_transfer-499c", ec.exchange_url, +      "EUR:4.98", bc.exchange_payto, bc.user42_payto),      TALER_TESTING_cmd_check_bank_transfer -      ("check_bank_transfer-99c1", exchange_url, -      "EUR:0.98", exchange_account_payto, user_account_payto), +      ("check_bank_transfer-99c1", ec.exchange_url, +      "EUR:0.98", bc.exchange_payto, bc.user42_payto),      TALER_TESTING_cmd_check_bank_transfer -      ("check_bank_transfer-99c2", exchange_url, -      "EUR:0.98", exchange_account_payto, user_account_payto), +      ("check_bank_transfer-99c2", ec.exchange_url, +      "EUR:0.98", bc.exchange_payto, bc.user42_payto),      TALER_TESTING_cmd_check_bank_transfer -      ("check_bank_transfer-99c", exchange_url, -      "EUR:0.08", exchange_account_payto, user2_account_payto), +      ("check_bank_transfer-99c", ec.exchange_url, +      "EUR:0.08", bc.exchange_payto, bc.user43_payto),      TALER_TESTING_cmd_check_bank_transfer -      ("check_bank_transfer-aai-1", exchange_url, -      "EUR:5.01", user_account_payto, exchange_account_payto), +      ("check_bank_transfer-aai-1", ec.exchange_url, +      "EUR:5.01", bc.user42_payto, bc.exchange_payto),      /**       * NOTE: the old test-suite had this "check bank transfer"       * command with debit account == 424.       */      TALER_TESTING_cmd_check_bank_transfer -      ("check_bank_transfer-aai-2", exchange_url, -      "EUR:5.01", user_account_payto, exchange_account_payto), +      ("check_bank_transfer-aai-2", ec.exchange_url, +      "EUR:5.01", bc.user42_payto, bc.exchange_payto),      TALER_TESTING_cmd_check_bank_empty ("check_bank_empty"), @@ -454,9 +404,9 @@ run (void *cls,      /* "consume" reserve creation transfer.  */      TALER_TESTING_cmd_check_bank_transfer        ("check_bank_transfer-unaggregated", -      exchange_url, +      ec.exchange_url,        "EUR:5.01", -      user_account_payto, exchange_account_payto), +      bc.user42_payto, bc.exchange_payto),      TALER_TESTING_cmd_withdraw_amount        ("withdraw-coin-unaggregated", @@ -468,9 +418,7 @@ run (void *cls,        ("deposit-unaggregated",        "withdraw-coin-unaggregated",        0, -      TALER_TESTING_make_wire_details -        (43, -        fakebank_url), +      bc.user43_payto,        "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",        GNUNET_TIME_relative_multiply          (GNUNET_TIME_UNIT_YEARS, @@ -513,8 +461,7 @@ run (void *cls,       */      TALER_TESTING_cmd_deposit        ("deposit-refund-1", "withdraw-coin-r1", 0, -      TALER_TESTING_make_wire_details (42, -                                       fakebank_url), +      bc.user42_payto,        "{\"items\":[{\"name\":\"ice cream\","        "\"value\":\"EUR:5\"}]}",        GNUNET_TIME_UNIT_MINUTES, "EUR:5", MHD_HTTP_OK), @@ -533,8 +480,8 @@ run (void *cls,       * fakebank and the second to actually check there are not       * other transfers around.       */TALER_TESTING_cmd_check_bank_transfer -      ("check_bank_transfer-pre-refund", exchange_url, -      "EUR:5.01", user_account_payto, exchange_account_payto), +      ("check_bank_transfer-pre-refund", ec.exchange_url, +      "EUR:5.01", bc.user42_payto, bc.exchange_payto),      TALER_TESTING_cmd_check_bank_empty        ("check_bank_transfer-pre-refund"), @@ -558,8 +505,7 @@ run (void *cls,       * 1 ct deposit fee) */      TALER_TESTING_cmd_deposit        ("deposit-refund-2", "withdraw-coin-r1", 0, -      TALER_TESTING_make_wire_details (42, -                                       fakebank_url), +      bc.user42_payto,        "{\"items\":[{\"name\":\"more ice cream\","        "\"value\":\"EUR:5\"}]}",        GNUNET_TIME_UNIT_ZERO, "EUR:4.99", MHD_HTTP_OK), @@ -575,8 +521,8 @@ run (void *cls,       * Check that deposit did run.       */      TALER_TESTING_cmd_check_bank_transfer -      ("check_bank_transfer-pre-refund", exchange_url, -      "EUR:4.97", exchange_account_payto, user_account_payto), +      ("check_bank_transfer-pre-refund", ec.exchange_url, +      "EUR:4.97", bc.exchange_payto, bc.user42_payto),      /**       * Run failing refund, as past deadline & aggregation. @@ -603,14 +549,13 @@ run (void *cls,                                         MHD_HTTP_OK),      TALER_TESTING_cmd_check_bank_transfer -      ("check_bank_transfer-aai-3b", exchange_url, -      "EUR:5.01", user_account_payto, exchange_account_payto), +      ("check_bank_transfer-aai-3b", ec.exchange_url, +      "EUR:5.01", bc.user42_payto, bc.exchange_payto),      TALER_TESTING_cmd_deposit        ("deposit-refund-1b", "withdraw-coin-rb", 0, -      TALER_TESTING_make_wire_details (42, -                                       fakebank_url), +      bc.user42_payto,        "{\"items\":[{\"name\":\"ice cream\","        "\"value\":\"EUR:5\"}]}",        GNUNET_TIME_UNIT_ZERO, "EUR:5", MHD_HTTP_OK), @@ -723,17 +668,17 @@ run (void *cls,      TALER_TESTING_cmd_check_bank_transfer        ("check_bank_short-lived_transfer", -      exchange_url, +      ec.exchange_url,        "EUR:5.01", -      user_account_payto, -      exchange_account_payto), +      bc.user42_payto, +      bc.exchange_payto),      TALER_TESTING_cmd_check_bank_transfer        ("check_bank_short-lived_reimburse", -      exchange_url, +      ec.exchange_url,        "EUR:5", -      exchange_account_payto, -      user_account_payto), +      bc.exchange_payto, +      bc.user42_payto),      /**       * Fill reserve with EUR:2.02, as withdraw fee is 1 ct per @@ -762,8 +707,7 @@ run (void *cls,      TALER_TESTING_cmd_deposit        ("payback-deposit-partial",        "payback-withdraw-coin-2a", 0, -      TALER_TESTING_make_wire_details (42, -                                       fakebank_url), +      bc.user42_payto,        "{\"items\":[{\"name\":\"more ice cream\",\"value\":1}]}",        GNUNET_TIME_UNIT_ZERO, "EUR:0.5", MHD_HTTP_OK), @@ -785,8 +729,7 @@ run (void *cls,      TALER_TESTING_cmd_deposit        ("payback-deposit-revoked",        "payback-withdraw-coin-2b", 0, -      TALER_TESTING_make_wire_details (42, -                                       fakebank_url), +      bc.user42_payto,        "{\"items\":[{\"name\":\"more ice cream\",\"value\":1}]}",        GNUNET_TIME_UNIT_ZERO, "EUR:1", MHD_HTTP_NOT_FOUND), @@ -800,9 +743,7 @@ run (void *cls,        ("payback-deposit-partial-after-payback",        "payback-withdraw-coin-2a",        0, -      TALER_TESTING_make_wire_details -        (42, -        fakebank_url), +      bc.user42_payto,        "{\"items\":[{\"name\":\"extra ice cream\",\"value\":1}]}",        GNUNET_TIME_UNIT_ZERO,        "EUR:0.5", @@ -822,14 +763,14 @@ run (void *cls,      /* check that we are empty before the rejection test */      TALER_TESTING_cmd_check_bank_transfer -      ("check_bank_transfer-pr1", exchange_url, -      "EUR:5.01", user_account_payto, exchange_account_payto), +      ("check_bank_transfer-pr1", ec.exchange_url, +      "EUR:5.01", bc.user42_payto, bc.exchange_payto),      TALER_TESTING_cmd_check_bank_transfer -      ("check_bank_transfer-pr2", exchange_url, -      "EUR:2.02", user_account_payto, exchange_account_payto), +      ("check_bank_transfer-pr2", ec.exchange_url, +      "EUR:2.02", bc.user42_payto, bc.exchange_payto),      TALER_TESTING_cmd_check_bank_transfer -      ("check_bank_transfer-pr3", exchange_url, -      "EUR:1.01", user_account_payto, exchange_account_payto), +      ("check_bank_transfer-pr3", ec.exchange_url, +      "EUR:1.01", bc.user42_payto, bc.exchange_payto),      TALER_TESTING_cmd_check_bank_empty        ("check-empty-again"), @@ -859,8 +800,7 @@ run (void *cls,       */TALER_TESTING_cmd_deposit        ("deposit-partial",        "withdraw-coin-1", 0, -      TALER_TESTING_make_wire_details (42, -                                       fakebank_url), +      bc.user42_payto,        "{\"items\":[{\"name\":\"ice cream\",\                       \"value\":\"EUR:1\"}]}",        GNUNET_TIME_UNIT_ZERO, "EUR:1", MHD_HTTP_OK), @@ -1008,7 +948,7 @@ run (void *cls,    TALER_TESTING_run_with_fakebank (is,                                     commands, -                                   fakebank_url); +                                   bc.bank_url);  } @@ -1022,19 +962,18 @@ main (int argc,    GNUNET_log_setup ("test-exchange-api",                      "INFO",                      NULL); -  if (NULL == (fakebank_url -               /* Check fakebank port is available and config cares -                * about bank url. */ -                 = TALER_TESTING_prepare_fakebank (CONFIG_FILE, -                                                   "account-2"))) +  /* Check fakebank port is available and get config */ +  if (GNUNET_OK != +      TALER_TESTING_prepare_fakebank (CONFIG_FILE, +                                      "account-2", +                                      &bc))      return 77;    TALER_TESTING_cleanup_files (CONFIG_FILE);    /* @helpers.  Run keyup, create tables, ... Note: it     * fetches the port number from config in order to see     * if it's available. */    switch (TALER_TESTING_prepare_exchange (CONFIG_FILE, -                                          &auditor_url, -                                          &exchange_url)) +                                          &ec))    {    case GNUNET_SYSERR:      GNUNET_break (0); diff --git a/src/lib/test_exchange_api_keys_cherry_picking.c b/src/lib/test_exchange_api_keys_cherry_picking.c index 8805e7c5..12ee26e6 100644 --- a/src/lib/test_exchange_api_keys_cherry_picking.c +++ b/src/lib/test_exchange_api_keys_cherry_picking.c @@ -17,7 +17,7 @@    <http://www.gnu.org/licenses/>  */  /** - * @file exchange-lib/test_exchange_api_keys_cherry_picking.c + * @file lib/test_exchange_api_keys_cherry_picking.c   * @brief testcase to test exchange's /keys cherry picking ability   * @author Marcello Stanisci   * @author Christian Grothoff @@ -84,14 +84,9 @@  #define JAN2030 "2030-01-01"  /** - * Exchange base URL; mainly purpose is to make the compiler happy. + * Exchange configuration data.   */ -static char *exchange_url; - -/** - * Auditor base URL; mainly purpose is to make the compiler happy. - */ -static char *auditor_url; +static struct TALER_TESTING_ExchangeConfiguration ec;  /** @@ -239,8 +234,7 @@ main (int argc,     * fetches the port number from config in order to see     * if it's available. */    switch (TALER_TESTING_prepare_exchange (CONFIG_FILE, -                                          &auditor_url, -                                          &exchange_url)) +                                          &ec))    {    case GNUNET_SYSERR:      GNUNET_break (0); diff --git a/src/lib/test_exchange_api_overlapping_keys_bug.c b/src/lib/test_exchange_api_overlapping_keys_bug.c index a5ddac51..c6cd17cb 100644 --- a/src/lib/test_exchange_api_overlapping_keys_bug.c +++ b/src/lib/test_exchange_api_overlapping_keys_bug.c @@ -55,14 +55,9 @@    "test_exchange_api_keys_cherry_picking_extended_2.conf"  /** - * Exchange base URL; mainly purpose is to make the compiler happy. + * Exchange configuration data.   */ -static char *exchange_url; - -/** - * Auditor base URL; mainly purpose is to make the compiler happy. - */ -static char *auditor_url; +static struct TALER_TESTING_ExchangeConfiguration ec;  /** @@ -106,8 +101,7 @@ main (int argc,     * fetches the port number from config in order to see     * if it's available. */    switch (TALER_TESTING_prepare_exchange (CONFIG_FILE, -                                          &auditor_url, -                                          &exchange_url)) +                                          &ec))    {    case GNUNET_SYSERR:      GNUNET_break (0); diff --git a/src/lib/test_exchange_api_twisted.c b/src/lib/test_exchange_api_twisted.c index d9faec4a..d935ca8e 100644 --- a/src/lib/test_exchange_api_twisted.c +++ b/src/lib/test_exchange_api_twisted.c @@ -33,7 +33,6 @@  #include "taler_bank_service.h"  #include "taler_fakebank_lib.h"  #include "taler_testing_lib.h" -#include "taler_testing_bank_lib.h"  #include <taler/taler_twister_testing_lib.h>  #include <taler/taler_twister_service.h> @@ -49,47 +48,20 @@  static char *twister_url;  /** - * URL of the fakebank.  Obtained from CONFIG_FILE's - * "exchange-wire-test:BANK_URI" option. + * Exchange configuration data.   */ -static char *fakebank_url; +static struct TALER_TESTING_ExchangeConfiguration ec;  /** - * Exchange base URL. + * Bank configuration data.   */ -static char *exchange_url; - -/** - * Auditor URL, unused but needed to achieve compilation. - */ -static char *auditor_url; +static struct TALER_TESTING_BankConfiguration bc;  /**   * Twister process.   */  static struct GNUNET_OS_Process *twisterd; -/** - * URL of the exchange's account at the bank.  Obtained from CONFIG_FILE's - * "exchange-wire-test:BANK_URI" option plus the exchange account. - */ -static char *exchange_account_url; // FIXME: initialize! - -/** - * Account number of the exchange at the bank. - */ -#define EXCHANGE_ACCOUNT_NO "2" // FIXME: used? - -/** - * Payto URL of the user's account. - */ -static char *user_account_payto; // FIXME: initialize! - -/** - * Credentials for talking to the bank. - */ -static struct TALER_BANK_AuthenticationData auth; // FIXME: initialize! -  /**   * Execute the taler-exchange-wirewatch command with @@ -119,9 +91,9 @@ static struct TALER_BANK_AuthenticationData auth; // FIXME: initialize!   */  #define CMD_TRANSFER_TO_EXCHANGE(label,amount) \    TALER_TESTING_cmd_admin_add_incoming (label, amount, \ -                                        exchange_account_url, \ -                                        &auth, \ -                                        user_account_payto) +                                        bc.exchange_account_url,   \ +                                        &bc.exchange_auth, \ +                                        bc.user42_payto)  /** @@ -160,9 +132,7 @@ run (void *cls,        ("refresh-deposit-partial",        "refresh-withdraw-coin",        0, -      TALER_TESTING_make_wire_details -        (42, -        fakebank_url), +      bc.user42_payto,        "{\"items\":[{\"name\":\"ice cream\",\                       \"value\":\"EUR:1\"}]}",        GNUNET_TIME_UNIT_ZERO, @@ -212,9 +182,7 @@ run (void *cls,        ("deposit-refund-1",        "withdraw-coin-r1",        0, -      TALER_TESTING_make_wire_details -        (42, -        fakebank_url), +      bc.user42_payto,        "{\"items\":[{\"name\":\"ice cream\","        "\"value\":\"EUR:5\"}]}",        GNUNET_TIME_UNIT_MINUTES, @@ -251,9 +219,7 @@ run (void *cls,        ("deposit-refund-to-fail",        "withdraw-coin-r1",        0,  /* coin index.  */ -      TALER_TESTING_make_wire_details -        (42, -        fakebank_url), +      bc.user42_payto,        /* This parameter will make any comparison about           h_contract_terms fail, when /refund will be handled.           So in other words, this is h_contract missmatch.  */ @@ -293,7 +259,7 @@ run (void *cls,    TALER_TESTING_run_with_fakebank (is,                                     commands, -                                   fakebank_url); +                                   bc.bank_url);  } @@ -322,9 +288,10 @@ main (int argc,    GNUNET_log_setup ("test-exchange-api-twisted",                      "DEBUG", NULL); -  if (NULL == (fakebank_url = TALER_TESTING_prepare_fakebank -                                (CONFIG_FILE, -                                "account-2"))) +  if (GNUNET_OK != +      TALER_TESTING_prepare_fakebank (CONFIG_FILE, +                                      "account-2", +                                      &bc))      return 77;    if (NULL == (twister_url = TALER_TESTING_prepare_twister @@ -334,8 +301,7 @@ main (int argc,    TALER_TESTING_cleanup_files (CONFIG_FILE);    switch (TALER_TESTING_prepare_exchange (CONFIG_FILE, -                                          &auditor_url, -                                          &exchange_url)) +                                          &ec))    {    case GNUNET_SYSERR:      GNUNET_break (0); @@ -345,8 +311,7 @@ main (int argc,    case GNUNET_OK: -    if (NULL == (twisterd = TALER_TESTING_run_twister -                              (CONFIG_FILE))) +    if (NULL == (twisterd = TALER_TESTING_run_twister (CONFIG_FILE)))        return 77;      ret = TALER_TESTING_setup_with_exchange (&run, diff --git a/src/lib/testing_api_cmd_bank_admin_add_incoming.c b/src/lib/testing_api_cmd_bank_admin_add_incoming.c index 770b2e38..690b7843 100644 --- a/src/lib/testing_api_cmd_bank_admin_add_incoming.c +++ b/src/lib/testing_api_cmd_bank_admin_add_incoming.c @@ -30,7 +30,6 @@  #include "taler_fakebank_lib.h"  #include "taler_signatures.h"  #include "taler_testing_lib.h" -#include "taler_testing_bank_lib.h"  /** diff --git a/src/lib/testing_api_cmd_bank_history_credit.c b/src/lib/testing_api_cmd_bank_history_credit.c index fefb2dda..92a28c22 100644 --- a/src/lib/testing_api_cmd_bank_history_credit.c +++ b/src/lib/testing_api_cmd_bank_history_credit.c @@ -26,7 +26,6 @@  #include <gnunet/gnunet_curl_lib.h>  #include "taler_exchange_service.h"  #include "taler_testing_lib.h" -#include "taler_testing_bank_lib.h"  #include "taler_fakebank_lib.h"  #include "taler_bank_service.h"  #include "taler_fakebank_lib.h" diff --git a/src/lib/testing_api_cmd_bank_history_debit.c b/src/lib/testing_api_cmd_bank_history_debit.c index 96f989c0..0b0cc40e 100644 --- a/src/lib/testing_api_cmd_bank_history_debit.c +++ b/src/lib/testing_api_cmd_bank_history_debit.c @@ -16,19 +16,16 @@    License along with TALER; see the file COPYING.  If not, see    <http://www.gnu.org/licenses/>  */ -  /**   * @file bank-lib/testing_api_cmd_history.c   * @brief command to check the /history API from the bank.   * @author Marcello Stanisci   */ -  #include "platform.h"  #include "taler_json_lib.h"  #include <gnunet/gnunet_curl_lib.h>  #include "taler_exchange_service.h"  #include "taler_testing_lib.h" -#include "taler_testing_bank_lib.h"  #include "taler_fakebank_lib.h"  #include "taler_bank_service.h"  #include "taler_fakebank_lib.h" diff --git a/src/lib/testing_api_cmd_bank_transfer.c b/src/lib/testing_api_cmd_bank_transfer.c index d5a3872e..575c09c5 100644 --- a/src/lib/testing_api_cmd_bank_transfer.c +++ b/src/lib/testing_api_cmd_bank_transfer.c @@ -30,7 +30,6 @@  #include "taler_fakebank_lib.h"  #include "taler_signatures.h"  #include "taler_testing_lib.h" -#include "taler_testing_bank_lib.h"  /** diff --git a/src/lib/testing_api_cmd_deposit.c b/src/lib/testing_api_cmd_deposit.c index c1c07a01..7c7e4936 100644 --- a/src/lib/testing_api_cmd_deposit.c +++ b/src/lib/testing_api_cmd_deposit.c @@ -480,7 +480,7 @@ deposit_traits (void *cls,   *        coins, this parameter selects which one in that array.   *        This value is currently ignored, as only one-coin   *        withdrawals are implemented. - * @param wire_details wire details associated with the "deposit" + * @param target_account_payto target account for the "deposit"   *        request.   * @param contract_terms contract terms to be signed over by the   *        coin. @@ -497,14 +497,16 @@ TALER_TESTING_cmd_deposit    (const char *label,    const char *coin_reference,    unsigned int coin_index, -  json_t *wire_details, +  const char *target_account_payto,    const char *contract_terms,    struct GNUNET_TIME_Relative refund_deadline,    const char *amount,    unsigned int expected_response_code)  {    struct DepositState *ds; +  json_t *wire_details; +  wire_details = TALER_TESTING_make_wire_details (target_account_payto);    ds = GNUNET_new (struct DepositState);    ds->coin_reference = coin_reference;    ds->coin_index = coin_index; diff --git a/src/lib/testing_api_helpers_bank.c b/src/lib/testing_api_helpers_bank.c index 64976edb..52227f7b 100644 --- a/src/lib/testing_api_helpers_bank.c +++ b/src/lib/testing_api_helpers_bank.c @@ -1,6 +1,6 @@  /*    This file is part of TALER -  Copyright (C) 2018 Taler Systems SA +  Copyright (C) 2018-2020 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 @@ -16,16 +16,14 @@    License along with TALER; see the file COPYING.  If not, see    <http://www.gnu.org/licenses/>  */ -  /**   * @file bank-lib/testing_api_helpers.c   * @brief convenience functions for bank-lib tests.   * @author Marcello Stanisci   */ -  #include "platform.h"  #include <gnunet/gnunet_util_lib.h> -#include "taler_testing_bank_lib.h" +#include "taler_testing_lib.h"  #include "taler_fakebank_lib.h" @@ -34,29 +32,6 @@  /** - * Keep each bank account credentials at index: - * bank account number - 1 - */ -struct TALER_BANK_AuthenticationData AUTHS[] = { - -  /* Bank credentials */ -  {.method = TALER_BANK_AUTH_BASIC, -   .details.basic.username = TALER_TESTING_BANK_USERNAME, -   .details.basic.password = TALER_TESTING_BANK_PASSWORD}, - -  /* Exchange credentials */ -  {.method = TALER_BANK_AUTH_BASIC, -   .details.basic.username = TALER_TESTING_EXCHANGE_USERNAME, -   .details.basic.password = TALER_TESTING_EXCHANGE_PASSWORD }, - -  /* User credentials */ -  {.method = TALER_BANK_AUTH_BASIC, -   .details.basic.username = TALER_TESTING_USER_USERNAME, -   .details.basic.password = TALER_TESTING_USER_PASSWORD } -}; - - -/**   * Runs the Fakebank by guessing / extracting the portnumber   * from the base URL.   * @@ -244,19 +219,19 @@ TALER_TESTING_run_bank (const char *config_filename,   * and reset database.   *   * @param config_filename configuration file name. - * + * @param bc[out] set to the bank's configuration data   * @return the base url, or NULL upon errors.  Must be freed   *         by the caller.   */ -char * -TALER_TESTING_prepare_bank (const char *config_filename) +int +TALER_TESTING_prepare_bank (const char *config_filename, +                            struct TALER_TESTING_BankConfiguration *bc)  {    struct GNUNET_CONFIGURATION_Handle *cfg;    unsigned long long port;    struct GNUNET_OS_Process *dbreset_proc;    enum GNUNET_OS_ProcessStatusType type;    unsigned long code; -  char *base_url;    char *database;    cfg = GNUNET_CONFIGURATION_create (); @@ -265,7 +240,8 @@ TALER_TESTING_prepare_bank (const char *config_filename)        GNUNET_CONFIGURATION_load (cfg, config_filename))    {      GNUNET_CONFIGURATION_destroy (cfg); -    BANK_FAIL (); +    GNUNET_break (0); +    return GNUNET_SYSERR;    }    if (GNUNET_OK !=        GNUNET_CONFIGURATION_get_value_string (cfg, @@ -277,7 +253,8 @@ TALER_TESTING_prepare_bank (const char *config_filename)                                 "bank",                                 "DATABASE");      GNUNET_CONFIGURATION_destroy (cfg); -    BANK_FAIL (); +    GNUNET_break (0); +    return GNUNET_SYSERR;    }    if (GNUNET_OK != @@ -291,17 +268,21 @@ TALER_TESTING_prepare_bank (const char *config_filename)                                 "HTTP_PORT");      GNUNET_CONFIGURATION_destroy (cfg);      GNUNET_free (database); -    BANK_FAIL (); +    GNUNET_break (0); +    return GNUNET_SYSERR;    }    GNUNET_CONFIGURATION_destroy (cfg); -  if (GNUNET_OK != GNUNET_NETWORK_test_port_free -        (IPPROTO_TCP, (uint16_t) port)) +  if (GNUNET_OK != +      GNUNET_NETWORK_test_port_free (IPPROTO_TCP, +                                     (uint16_t) port))    {      fprintf (stderr,               "Required port %llu not available, skipping.\n",               port); -    BANK_FAIL (); +    GNUNET_break (0); +    GNUNET_free (database); +    return GNUNET_SYSERR;    }    /* DB preparation */ @@ -321,7 +302,7 @@ TALER_TESTING_prepare_bank (const char *config_filename)      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,                  "Failed to flush the bank db.\n");      GNUNET_free (database); -    BANK_FAIL (); +    return GNUNET_SYSERR;    }    GNUNET_free (database); @@ -331,31 +312,161 @@ TALER_TESTING_prepare_bank (const char *config_filename)                                       &code))    {      GNUNET_OS_process_destroy (dbreset_proc); -    BANK_FAIL (); +    GNUNET_break (0); +    return GNUNET_SYSERR;    }    if ( (type == GNUNET_OS_PROCESS_EXITED) &&         (0 != code) )    {      fprintf (stderr,               "Failed to setup database\n"); -    BANK_FAIL (); +    GNUNET_break (0); +    return GNUNET_SYSERR;    }    if ( (type != GNUNET_OS_PROCESS_EXITED) ||         (0 != code) )    { -    fprintf (stderr, -             "Unexpected error running" -             " `taler-bank-manage django flush..'!\n"); -    BANK_FAIL (); +    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, +                "Unexpected error running `taler-bank-manage django flush'!\n"); +    GNUNET_break (0); +    return GNUNET_SYSERR;    } -    GNUNET_OS_process_destroy (dbreset_proc); -  GNUNET_asprintf (&base_url, +  GNUNET_asprintf (&bc->bank_url,                     "http://localhost:%llu/",                     port); -  return base_url; +  // FIXME: initialize rest of 'bc': +  bc->exchange_account_url = NULL; // FIXME +  bc->exchange_auth; // FIXME +  bc->exchange_payto = TALER_TESTING_make_xtalerbank_payto (bc->bank_url, "2"); +  bc->user42_payto = TALER_TESTING_make_xtalerbank_payto (bc->bank_url, "42"); +  bc->user43_payto = TALER_TESTING_make_xtalerbank_payto (bc->bank_url, "43"); +  return GNUNET_OK; +} + + +/** + * Prepare launching a fakebank.  Check that the configuration + * file has the right option, and that the port is available. + * If everything is OK, return the configuration data of the fakebank. + * + * @param config_filename configuration file to use + * @param config_section which account to use (must match x-taler-bank) + * @param bc[out] set to the bank's configuration data + * @return #GNUNET_OK on success + */ +int +TALER_TESTING_prepare_fakebank (const char *config_filename, +                                const char *config_section, +                                struct TALER_TESTING_BankConfiguration *bc) +{ +  struct GNUNET_CONFIGURATION_Handle *cfg; +  char *payto_url; +  char *fakebank_url; +  const char *start; +  const char *end; + +  cfg = GNUNET_CONFIGURATION_create (); +  if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, +                                              config_filename)) +    return GNUNET_SYSERR; +  if (GNUNET_OK != +      GNUNET_CONFIGURATION_get_value_string (cfg, +                                             config_section, +                                             "URL", +                                             &payto_url)) +  { +    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, +                               config_section, +                               "URL"); +    GNUNET_CONFIGURATION_destroy (cfg); +    return GNUNET_SYSERR; +  } +  GNUNET_CONFIGURATION_destroy (cfg); +  if (0 != strncasecmp (payto_url, +                        "payto://x-taler-bank/", +                        strlen ("payto://x-taler-bank/"))) +  { +    GNUNET_log_config_invalid +      (GNUNET_ERROR_TYPE_WARNING, +      config_section, +      "URL", +      "expected `x-taler-bank' payto://-URL"); +    GNUNET_CONFIGURATION_destroy (cfg); +    GNUNET_free (payto_url); +    return GNUNET_SYSERR; +  } +  start = &payto_url [strlen ("payto://x-taler-bank/")]; +  end = strchr (start, +                (unsigned char) '/'); +  if (NULL == end) +    end = &start[strlen (start)]; +  fakebank_url = GNUNET_strndup (start, +                                 end - start); +  GNUNET_free (payto_url); +  if (GNUNET_OK != +      TALER_TESTING_url_port_free (fakebank_url)) +  { +    GNUNET_free (fakebank_url); +    return GNUNET_SYSERR; +  } +  bc->bank_url = fakebank_url; +  // FIXME: initialize rest of 'bc': +  bc->exchange_account_url = NULL; // FIXME +  bc->exchange_auth; // FIXME +  bc->exchange_payto = TALER_TESTING_make_xtalerbank_payto (bc->bank_url, "2"); +  bc->user42_payto = TALER_TESTING_make_xtalerbank_payto (bc->bank_url, "42"); +  bc->user43_payto = TALER_TESTING_make_xtalerbank_payto (bc->bank_url, "43"); +  return GNUNET_OK; +} + + +/** + * Create an x-taler-bank payto:// URL from a @a bank_url + * and an @a account_name. + * + * @param bank_url the bank URL + * @param account_name the account name + * @return payto:// URL + */ +char * +TALER_TESTING_make_xtalerbank_payto (const char *bank_url, +                                     const char *account_name) +{ +  char *payto; +  int ends_slash; + +  if (0 < strlen (bank_url)) +    ends_slash = '/' == bank_url[strlen (bank_url) - 1]; +  else +    ends_slash = 0; +  GNUNET_asprintf (&payto, +                   (ends_slash) +                   ? "payto://x-taler-bank/%s%s" +                   : "payto://x-taler-bank/%s/%s", +                   bank_url, +                   account_name); +  return payto; +} + + +/** + * Allocate and return a piece of wire-details.  Combines + * a @a payto -URL and adds some salt to create the JSON. + * + * @param payto payto://-URL to encapsulate + * @return JSON describing the account, including the + *         payto://-URL of the account, must be manually decref'd + */ +json_t * +TALER_TESTING_make_wire_details (const char *payto) +{ +  return json_pack ("{s:s, s:s}", +                    "url", payto, +                    "salt", +                    "test-salt (must be constant for aggregation tests)");  } -/* end of testing_api_helpers.c */ +/* end of testing_api_helpers_bank.c */ diff --git a/src/lib/testing_api_helpers_exchange.c b/src/lib/testing_api_helpers_exchange.c index cc843078..1fed38d1 100644 --- a/src/lib/testing_api_helpers_exchange.c +++ b/src/lib/testing_api_helpers_exchange.c @@ -1,6 +1,6 @@  /*    This file is part of TALER -  Copyright (C) 2018 Taler Systems SA +  Copyright (C) 2018-2020 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 @@ -339,15 +339,9 @@ TALER_TESTING_auditor_db_reset (const char *config_filename)  struct SignInfo  {    /** -   * Set to the base URL of the exchange. To be free'd -   * by the caller. +   * Members will be set to the exchange configuration.     */ -  char *exchange_base_url; - -  /** -   * Set to the auditor's base URL. To be free'd by the caller. -   */ -  char *auditor_base_url; +  struct TALER_TESTING_ExchangeConfiguration *ec;    /**     * Name of the configuration file to use. @@ -379,17 +373,18 @@ sign_keys_for_exchange (void *cls,    char *test_home_dir;    char *signed_keys_out;    char *exchange_master_pub; +  int ret;    if (GNUNET_OK !=        GNUNET_CONFIGURATION_get_value_string (cfg,                                               "exchange",                                               "BASE_URL", -                                             &si->exchange_base_url)) +                                             &si->ec->exchange_url))    {      GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING,                                 "exchange",                                 "BASE_URL"); -    si->exchange_base_url = NULL; +    si->ec->exchange_url = NULL;      return GNUNET_NO;    } @@ -397,14 +392,14 @@ sign_keys_for_exchange (void *cls,        GNUNET_CONFIGURATION_get_value_string (cfg,                                               "auditor",                                               "BASE_URL", -                                             &si->auditor_base_url)) +                                             &si->ec->auditor_url))    {      GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING,                                 "auditor",                                 "BASE_URL"); -    GNUNET_free (si->exchange_base_url); -    si->exchange_base_url = NULL; -    si->auditor_base_url = NULL; +    GNUNET_free (si->ec->exchange_url); +    si->ec->exchange_url = NULL; +    si->ec->auditor_url = NULL;      return GNUNET_SYSERR;    } @@ -417,11 +412,8 @@ sign_keys_for_exchange (void *cls,      GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,                                 "paths",                                 "TALER_TEST_HOME"); -    GNUNET_free (si->exchange_base_url); -    GNUNET_free (si->auditor_base_url); -    si->exchange_base_url = NULL; -    si->auditor_base_url = NULL; -    return GNUNET_SYSERR; +    ret = GNUNET_SYSERR; +    goto fail;    }    GNUNET_asprintf (&signed_keys_out, @@ -438,42 +430,42 @@ sign_keys_for_exchange (void *cls,      GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,                                 "exchange",                                 "MASTER_PUBLIC_KEY"); -    GNUNET_free (si->exchange_base_url); -    GNUNET_free (si->auditor_base_url); -    si->exchange_base_url = NULL; -    si->auditor_base_url = NULL;      GNUNET_free (signed_keys_out); -    return GNUNET_SYSERR; +    ret = GNUNET_SYSERR; +    goto fail;    }    if (GNUNET_OK !=        TALER_TESTING_run_auditor_exchange (si->config_filename,                                            exchange_master_pub, -                                          si->exchange_base_url, +                                          si->ec->exchange_url,                                            GNUNET_NO))    { -    GNUNET_free (si->exchange_base_url); -    GNUNET_free (si->auditor_base_url); -    si->exchange_base_url = NULL; -    si->auditor_base_url = NULL; -    return GNUNET_NO; +    GNUNET_free (signed_keys_out); +    ret = GNUNET_NO; +    goto fail;    }    if (GNUNET_OK !=        TALER_TESTING_run_auditor_sign (si->config_filename,                                        exchange_master_pub, -                                      si->auditor_base_url, +                                      si->ec->auditor_url,                                        si->auditor_sign_input_filename,                                        signed_keys_out))    { -    GNUNET_free (si->exchange_base_url); -    GNUNET_free (si->auditor_base_url); -    si->exchange_base_url = NULL; -    si->auditor_base_url = NULL; -    return GNUNET_NO; +    GNUNET_free (signed_keys_out); +    GNUNET_free (exchange_master_pub); +    ret = GNUNET_NO; +    goto fail;    }    GNUNET_free (signed_keys_out);    GNUNET_free (exchange_master_pub);    return GNUNET_OK; +fail: +  GNUNET_free (si->ec->exchange_url); +  GNUNET_free (si->ec->auditor_url); +  si->ec->exchange_url = NULL; +  si->ec->auditor_url = NULL; +  return ret;  } @@ -484,24 +476,17 @@ sign_keys_for_exchange (void *cls,   * launch the exchange process itself.   *   * @param config_filename configuration file to use - * @param auditor_base_url[out] will be set to the auditor base url, - *        if the config has any; otherwise it will be set to - *        NULL. - * @param exchange_base_url[out] will be set to the exchange base url, - *        if the config has any; otherwise it will be set to - *        NULL. + * @param ec[out] will be set to the exchange configuration data   * @return #GNUNET_OK on success, #GNUNET_NO if test should be   *         skipped, #GNUNET_SYSERR on test failure   */  int  TALER_TESTING_prepare_exchange (const char *config_filename, -                                char **auditor_base_url, -                                char **exchange_base_url) +                                struct TALER_TESTING_ExchangeConfiguration *ec)  {    struct SignInfo si = {      .config_filename = config_filename, -    .exchange_base_url = NULL, -    .auditor_base_url = NULL, +    .ec = ec,      .auditor_sign_input_filename = "auditor.in"    }; @@ -520,8 +505,6 @@ TALER_TESTING_prepare_exchange (const char *config_filename,                                            &sign_keys_for_exchange,                                            &si))      return GNUNET_NO; -  *exchange_base_url = si.exchange_base_url; -  *auditor_base_url = si.auditor_base_url;    return GNUNET_OK;  } @@ -946,6 +929,9 @@ TALER_TESTING_setup_with_auditor_and_exchange (TALER_TESTING_Main main_cb,  /**   * Test port in URL string for availability. + * + * @param url URL to extract port from, 80 is default + * @return #GNUNET_OK if the port is free   */  int  TALER_TESTING_url_port_free (const char *url) @@ -972,109 +958,4 @@ TALER_TESTING_url_port_free (const char *url)  } -/** - * Allocate and return a piece of wire-details.  Combines - * the @a account_no and the @a bank_url to a - * @a payto://-URL and adds some salt to create the JSON. - * - * @param account_no account number - * @param bank_url the bank_url (FIXME/WARNING: shouldn't this be a _hostname_ ??) - * @return JSON describing the account, including the - *         payto://-URL of the account, must be manually decref'd - */ -json_t * -TALER_TESTING_make_wire_details (unsigned long long account_no, -                                 const char *bank_url) -{ -  char *payto; -  json_t *ret; -  int ends_slash; - -  if (0 < strlen (bank_url)) -    ends_slash = '/' == bank_url[strlen (bank_url) - 1]; -  else -    ends_slash = 0; - -  GNUNET_asprintf (&payto, -                   (ends_slash) -                   ? "payto://x-taler-bank/%s%llu" -                   : "payto://x-taler-bank/%s/%llu", -                   bank_url, -                   account_no); -  ret = json_pack ("{s:s, s:s}", -                   "url", payto, -                   "salt", -                   "test-salt (must be constant for aggregation tests)"); -  GNUNET_free (payto); -  return ret; -} - - -/** - * Prepare launching a fakebank.  Check that the configuration - * file has the right option, and that the port is available. - * If everything is OK, return the configured URL of the fakebank. - * - * @param config_filename configuration file to use - * @param config_section which account to use (must match x-taler-bank) - * @return NULL on error, fakebank URL otherwise - */ -char * -TALER_TESTING_prepare_fakebank (const char *config_filename, -                                const char *config_section) -{ -  struct GNUNET_CONFIGURATION_Handle *cfg; -  char *payto_url; -  char *fakebank_url; -  const char *start; -  const char *end; - -  cfg = GNUNET_CONFIGURATION_create (); -  if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, -                                              config_filename)) -    return NULL; -  if (GNUNET_OK != -      GNUNET_CONFIGURATION_get_value_string (cfg, -                                             config_section, -                                             "URL", -                                             &payto_url)) -  { -    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, -                               config_section, -                               "URL"); -    GNUNET_CONFIGURATION_destroy (cfg); -    return NULL; -  } -  GNUNET_CONFIGURATION_destroy (cfg); -  if (0 != strncasecmp (payto_url, -                        "payto://x-taler-bank/", -                        strlen ("payto://x-taler-bank/"))) -  { -    GNUNET_log_config_invalid -      (GNUNET_ERROR_TYPE_WARNING, -      config_section, -      "URL", -      "expected `x-taler-bank' payto://-URL"); -    GNUNET_CONFIGURATION_destroy (cfg); -    GNUNET_free (payto_url); -    return NULL; -  } -  start = &payto_url [strlen ("payto://x-taler-bank/")]; -  end = strchr (start, -                (unsigned char) '/'); -  if (NULL == end) -    end = &start[strlen (start)]; -  fakebank_url = GNUNET_strndup (start, -                                 end - start); -  GNUNET_free (payto_url); -  if (GNUNET_OK != -      TALER_TESTING_url_port_free (fakebank_url)) -  { -    GNUNET_free (fakebank_url); -    return NULL; -  } -  return fakebank_url; -} - -  /* end of testing_api_helpers.c */ | 
