diff options
author | Marcello Stanisci <stanisci.m@gmail.com> | 2020-01-13 14:33:48 +0100 |
---|---|---|
committer | Marcello Stanisci <stanisci.m@gmail.com> | 2020-01-13 14:33:48 +0100 |
commit | ab7aba63fe3c1515b2faf7db6428257ccafb4fff (patch) | |
tree | 4e423ef82c337c5707a5d9eab6af52d7a2308726 | |
parent | aa45403b79918626c8c676df39d6a1fd001f869f (diff) | |
download | merchant-ab7aba63fe3c1515b2faf7db6428257ccafb4fff.tar.gz merchant-ab7aba63fe3c1515b2faf7db6428257ccafb4fff.tar.bz2 merchant-ab7aba63fe3c1515b2faf7db6428257ccafb4fff.zip |
fix twisted test compilation
-rw-r--r-- | src/lib/test_merchant_api.c | 36 | ||||
-rw-r--r-- | src/lib/test_merchant_api_twisted.c | 76 |
2 files changed, 65 insertions, 47 deletions
diff --git a/src/lib/test_merchant_api.c b/src/lib/test_merchant_api.c index a14f10cf..50e17cf6 100644 --- a/src/lib/test_merchant_api.c +++ b/src/lib/test_merchant_api.c @@ -92,17 +92,17 @@ static struct GNUNET_CONTAINER_MultiHashMap *interned_strings; /** * Account number of the exchange at the bank. */ -#define EXCHANGE_ACCOUNT_NO 2 +#define EXCHANGE_ACCOUNT_PATH "/2" /** * Account number of some user. */ -#define USER_ACCOUNT_NO 62 +#define USER_ACCOUNT_PATH "/62" /** * Account number used by the merchant */ -#define MERCHANT_ACCOUNT_NO 3 +#define MERCHANT_ACCOUNT_PATH "/3" /** * User name. Never checked by fakebank. @@ -1081,28 +1081,20 @@ main (int argc, GNUNET_assert (GNUNET_SYSERR != GNUNET_asprintf (&payer_url, - "%s/%d", - USER_ACCOUNT_NO)); - GNUNET_assert - (GNUNET_SYSERR != GNUNET_asprintf (&payer_payto, - "payto://x-taler-bank/%s/%d", - strchr (strchr (fakebank_url, '/') + 1, '/') + 1, - USER_ACCOUNT_NO)); + "%s%s", + USER_ACCOUNT_PATH)); GNUNET_assert (GNUNET_SYSERR != GNUNET_asprintf (&exchange_account_url, - "%s/%d", + "%s%s", fakebank_url, - EXCHANGE_ACCOUNT_NO)); - GNUNET_assert - (GNUNET_SYSERR != GNUNET_asprintf (&exchange_payto, - "payto://x-taler-bank/%s/%d", - strchr (strchr (fakebank_url, '/') + 1, '/') + 1, - EXCHANGE_ACCOUNT_NO)); - GNUNET_assert - (GNUNET_SYSERR != GNUNET_asprintf (&merchant_payto, - "payto://x-taler-bank/%s/%d", - strchr (strchr (fakebank_url, '/') + 1, '/') + 1, - MERCHANT_ACCOUNT_NO)); + EXCHANGE_ACCOUNT_PATH)); + + payer_payto = TALER_TESTING_make_xtalerbank_payto (fakebank_url, + USER_ACCOUNT_PATH); + exchange_payto = TALER_TESTING_make_xtalerbank_payto (fakebank_url, + EXCHANGE_ACCOUNT_PATH); + merchant_payto = TALER_TESTING_make_xtalerbank_payto (fakebank_url, + MERCHANT_ACCOUNT_PATH); if (NULL == (merchant_url = TALER_TESTING_prepare_merchant (CONFIG_FILE))) return 77; diff --git a/src/lib/test_merchant_api_twisted.c b/src/lib/test_merchant_api_twisted.c index ab2c3013..91e51970 100644 --- a/src/lib/test_merchant_api_twisted.c +++ b/src/lib/test_merchant_api_twisted.c @@ -120,20 +120,30 @@ static struct GNUNET_OS_Process *twisterexchanged; */ static struct GNUNET_OS_Process *twistermerchantd; + +static char *payer_url; +static char *payer_payto; +static char *exchange_payto; +static char *merchant_payto; +static struct TALER_BANK_AuthenticationData auth; +static struct TALER_WireTransferIdentifierRawP wtid; +static struct TALER_TESTING_BankConfiguration bc; +static struct TALER_TESTING_ExchangeConfiguration ec; + /** * Account number of the exchange at the bank. */ -#define EXCHANGE_ACCOUNT_NO 2 +#define EXCHANGE_ACCOUNT_PATH "/2" /** * Account number of the merchant at the bank. */ -#define MERCHANT_ACCOUNT_NO 3 +#define MERCHANT_ACCOUNT_PATH "/3" /** * Account number of some user. */ -#define USER_ACCOUNT_NO 62 +#define USER_ACCOUNT_PATH "/62" /** * User name. Never checked by fakebank. @@ -163,6 +173,8 @@ static struct GNUNET_OS_Process *twistermerchantd; #define CMD_EXEC_AGGREGATOR(label) \ TALER_TESTING_cmd_exec_aggregator (label, CONFIG_FILE) + + /** * Run wire transfer of funds from some user's account to the * exchange. @@ -172,11 +184,12 @@ static struct GNUNET_OS_Process *twistermerchantd; * @param url exchange_url */ #define CMD_TRANSFER_TO_EXCHANGE(label,amount) \ - TALER_TESTING_cmd_fakebank_transfer (label, amount, \ - fakebank_url, USER_ACCOUNT_NO, \ - EXCHANGE_ACCOUNT_NO, \ - USER_LOGIN_NAME, USER_LOGIN_PASS, \ - EXCHANGE_URL) + TALER_TESTING_cmd_transfer (label, amount, \ + payer_url, \ + &auth, \ + exchange_payto, \ + &wtid, \ + EXCHANGE_URL) /** * Run wire transfer of funds from some user's account to the @@ -220,8 +233,8 @@ run (void *cls, ("5719-check-transfer", EXCHANGE_URL, "EUR:1.01", - USER_ACCOUNT_NO, - EXCHANGE_ACCOUNT_NO), + payer_payto, + exchange_payto), TALER_TESTING_cmd_withdraw_amount ("5719-withdraw", "5719-create-reserve", @@ -553,8 +566,8 @@ run (void *cls, ("check_bank_transfer-unaggregation", EXCHANGE_URL, "EUR:5.01", - USER_ACCOUNT_NO, - EXCHANGE_ACCOUNT_NO), + payer_payto, + exchange_payto), TALER_TESTING_cmd_check_bank_empty ("check_bank_unaggregated-a"), @@ -618,8 +631,8 @@ run (void *cls, ("check_bank_transfer-5383", EXCHANGE_URL, "EUR:2.02", - USER_ACCOUNT_NO, - EXCHANGE_ACCOUNT_NO), + payer_payto, + exchange_payto), TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-5383a", "create-reserve-5383", @@ -667,8 +680,8 @@ run (void *cls, deposit fee 0.01 * 2 - wire fee 0.01 */"EUR:1.97", - EXCHANGE_ACCOUNT_NO, - MERCHANT_ACCOUNT_NO), + exchange_payto, + merchant_payto), TALER_TESTING_cmd_modify_object_dl ("hack-5383", PROXY_EXCHANGE_CONFIG_FILE, @@ -702,7 +715,9 @@ run (void *cls, TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-2", EXCHANGE_URL, - "EUR:2.02", USER_ACCOUNT_NO, EXCHANGE_ACCOUNT_NO), + "EUR:2.02", + payer_payto, + exchange_payto), TALER_TESTING_cmd_check_bank_empty ("track_chunk_check_empty-a"), @@ -770,8 +785,8 @@ run (void *cls, deposit fee 0.01 * 2 - wire fee 0.01 */"EUR:1.97", - EXCHANGE_ACCOUNT_NO, - MERCHANT_ACCOUNT_NO), + exchange_payto, + merchant_payto), /** * Fake total to include only one coin. Math: each 1-EUR @@ -821,7 +836,7 @@ run (void *cls, TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-abort-1", EXCHANGE_URL, - "EUR:1.01", USER_ACCOUNT_NO, EXCHANGE_ACCOUNT_NO), + "EUR:1.01", payer_payto, exchange_payto), TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-abort-1", "create-reserve-abort-1", @@ -1057,11 +1072,23 @@ main (int argc, GNUNET_log_setup ("test-merchant-api-twisted", "DEBUG", NULL); - if (NULL == (fakebank_url = TALER_TESTING_prepare_fakebank - (CONFIG_FILE, - "account-exchange"))) + if (GNUNET_OK != TALER_TESTING_prepare_fakebank (CONFIG_FILE, + "account-exchange", + &bc)) return 77; + + exchange_payto = TALER_TESTING_make_xtalerbank_payto (fakebank_url, + EXCHANGE_ACCOUNT_PATH); + payer_payto = TALER_TESTING_make_xtalerbank_payto (fakebank_url, + USER_ACCOUNT_PATH); + merchant_payto = TALER_TESTING_make_xtalerbank_payto (fakebank_url, + MERCHANT_ACCOUNT_PATH); + GNUNET_asprintf (&payer_url, + "%s%s", + fakebank_url, + USER_ACCOUNT_PATH); + if (NULL == (merchant_url = TALER_TESTING_prepare_merchant (CONFIG_FILE))) return 77; @@ -1082,8 +1109,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); |