diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-01-15 11:14:11 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-01-15 11:14:11 +0100 |
commit | 3fa213e41e82a93f8f5c5cd59b599ff78d0acc3a (patch) | |
tree | 6e208ac8cfaa376782d9703088e1029c94520d86 /src | |
parent | b1b0465f5424d4386fafc4af53fcf420ac68ca78 (diff) | |
download | exchange-3fa213e41e82a93f8f5c5cd59b599ff78d0acc3a.tar.xz |
fix test issues
Diffstat (limited to 'src')
-rw-r--r-- | src/bank-lib/bank_api_admin.c | 7 | ||||
-rw-r--r-- | src/bank-lib/fakebank.c | 55 | ||||
-rw-r--r-- | src/lib/auditor_api_handle.c | 1 | ||||
-rw-r--r-- | src/lib/exchange_api_reserve.c | 3 | ||||
-rw-r--r-- | src/lib/testing_api_cmd_withdraw.c | 29 |
5 files changed, 62 insertions, 33 deletions
diff --git a/src/bank-lib/bank_api_admin.c b/src/bank-lib/bank_api_admin.c index 2b6e45f45..6e4d937c5 100644 --- a/src/bank-lib/bank_api_admin.c +++ b/src/bank-lib/bank_api_admin.c @@ -209,9 +209,10 @@ TALER_BANK_admin_add_incoming (struct GNUNET_CURL_Context *ctx, aai->cb_cls = res_cb_cls; aai->request_url = TALER_BANK_path_to_url_ (account_base_url, "/admin/add-incoming"); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Requesting administrative transaction at `%s'\n", - aai->request_url); + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Requesting administrative transaction at `%s' for reserve %s\n", + aai->request_url, + TALER_B2S (reserve_pub)); aai->post_ctx.headers = curl_slist_append (aai->post_ctx.headers, "Content-Type: application/json"); diff --git a/src/bank-lib/fakebank.c b/src/bank-lib/fakebank.c index b99b78816..b12b04378 100644 --- a/src/bank-lib/fakebank.c +++ b/src/bank-lib/fakebank.c @@ -888,9 +888,9 @@ parse_history_common_args (struct MHD_Connection *connection, * @return MHD result code */ static int -handle_credit_history (struct TALER_FAKEBANK_Handle *h, - struct MHD_Connection *connection, - const char *account) +handle_debit_history (struct TALER_FAKEBANK_Handle *h, + struct MHD_Connection *connection, + const char *account) { struct HistoryArgs ha; struct Transaction *pos; @@ -939,7 +939,7 @@ handle_credit_history (struct TALER_FAKEBANK_Handle *h, while ( (0 != ha.delta) && (NULL != pos) ) { - if ( (0 == strcasecmp (pos->credit_account, + if ( (0 == strcasecmp (pos->debit_account, account)) && (T_DEBIT == pos->type) ) { @@ -972,6 +972,14 @@ handle_credit_history (struct TALER_FAKEBANK_Handle *h, else ha.delta++; } + else + { + fprintf (stderr, + "Skipping transaction %s->%s: only care about %s\n", + pos->debit_account, + pos->credit_account, + account); + } if (ha.delta > 0) pos = pos->prev; else @@ -994,9 +1002,9 @@ handle_credit_history (struct TALER_FAKEBANK_Handle *h, * @return MHD result code */ static int -handle_debit_history (struct TALER_FAKEBANK_Handle *h, - struct MHD_Connection *connection, - const char *account) +handle_credit_history (struct TALER_FAKEBANK_Handle *h, + struct MHD_Connection *connection, + const char *account) { struct HistoryArgs ha; struct Transaction *pos; @@ -1009,7 +1017,6 @@ handle_debit_history (struct TALER_FAKEBANK_Handle *h, GNUNET_break (0); return MHD_NO; } - if (! ha.have_start) { pos = (0 > ha.delta) @@ -1045,7 +1052,7 @@ handle_debit_history (struct TALER_FAKEBANK_Handle *h, while ( (0 != ha.delta) && (NULL != pos) ) { - if ( (0 == strcasecmp (pos->debit_account, + if ( (0 == strcasecmp (pos->credit_account, account)) && (T_CREDIT == pos->type) ) { @@ -1057,14 +1064,20 @@ handle_debit_history (struct TALER_FAKEBANK_Handle *h, pos->credit_account); debit_payto = TALER_payto_xtalerbank_make (h->my_baseurl, account); + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Returning transaction %s->%s (%s)\n", + debit_payto, + credit_payto, + TALER_B2S (&pos->subject)); trans = json_pack - ("{s:I, s:o, s:o, s:s, s:s, s:s}", + ("{s:I, s:o, s:o, s:s, s:s, s:o}", "row_id", (json_int_t) pos->row_id, "date", GNUNET_JSON_from_time_abs (pos->date), "amount", TALER_JSON_from_amount (&pos->amount), "credit_account", credit_payto, "debit_account", debit_payto, - "reserve_pub", pos->subject /* we "know" it is OK */); + "reserve_pub", GNUNET_JSON_from_data_auto ( + &pos->subject.credit)); GNUNET_free (credit_payto); GNUNET_free (debit_payto); GNUNET_assert (0 == @@ -1075,6 +1088,14 @@ handle_debit_history (struct TALER_FAKEBANK_Handle *h, else ha.delta++; } + else + { + fprintf (stderr, + "Skipping transaction %s->%s: only care about %s\n", + pos->debit_account, + pos->credit_account, + account); + } if (ha.delta > 0) pos = pos->prev; else @@ -1148,17 +1169,17 @@ serve (struct TALER_FAKEBANK_Handle *h, (NULL != account) && (0 == strcasecmp (method, MHD_HTTP_METHOD_GET)) ) - return handle_debit_history (h, - connection, - account); + return handle_credit_history (h, + connection, + account); if ( (0 == strcmp (url, "/history/outgoing")) && (NULL != account) && (0 == strcasecmp (method, MHD_HTTP_METHOD_GET)) ) - return handle_credit_history (h, - connection, - account); + return handle_debit_history (h, + connection, + account); /* Unexpected URL path, just close the connection. */ /* we're rather impolite here, but it's a testcase. */ diff --git a/src/lib/auditor_api_handle.c b/src/lib/auditor_api_handle.c index a3264c020..f1df204cb 100644 --- a/src/lib/auditor_api_handle.c +++ b/src/lib/auditor_api_handle.c @@ -412,6 +412,7 @@ MAH_path_to_url (struct TALER_AUDITOR_Handle *h, /** * Obtain the URL to use for an API request. + * FIXME: duplicates TEAH_path_to_url2, and likely also logic in util! * * @param base_url base URL of the auditor (i.e. "http://auditor/") * @param path Taler API path (i.e. "/deposit-confirmation") diff --git a/src/lib/exchange_api_reserve.c b/src/lib/exchange_api_reserve.c index 2c62cac20..d63d169b3 100644 --- a/src/lib/exchange_api_reserve.c +++ b/src/lib/exchange_api_reserve.c @@ -1051,6 +1051,9 @@ reserve_withdraw_internal (struct TALER_EXCHANGE_Handle *exchange, GNUNET_free (wsh); return NULL; } + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Attempting to withdraw from reserve %s\n", + TALER_B2S (reserve_pub)); wsh->ps = *ps; wsh->url = TEAH_path_to_url (exchange, "/reserve/withdraw"); diff --git a/src/lib/testing_api_cmd_withdraw.c b/src/lib/testing_api_cmd_withdraw.c index f559faf2c..09ab234dd 100644 --- a/src/lib/testing_api_cmd_withdraw.c +++ b/src/lib/testing_api_cmd_withdraw.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 published by @@ -363,8 +363,10 @@ withdraw_traits (void *cls, return GNUNET_SYSERR; } - if (GNUNET_OK != TALER_TESTING_get_trait_reserve_priv - (reserve_cmd, 0, &reserve_priv)) + if (GNUNET_OK != + TALER_TESTING_get_trait_reserve_priv (reserve_cmd, + 0, + &reserve_priv)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (ws->is); @@ -479,16 +481,17 @@ TALER_TESTING_cmd_withdraw_denomination ws->reserve_reference = reserve_reference; ws->pk = dk; ws->expected_response_code = expected_response_code; - - struct TALER_TESTING_Command cmd = { - .cls = ws, - .label = label, - .run = &withdraw_run, - .cleanup = &withdraw_cleanup, - .traits = &withdraw_traits - }; - - return cmd; + { + struct TALER_TESTING_Command cmd = { + .cls = ws, + .label = label, + .run = &withdraw_run, + .cleanup = &withdraw_cleanup, + .traits = &withdraw_traits + }; + + return cmd; + } } |