diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-05-07 14:21:40 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-05-07 14:21:40 +0200 |
commit | 56786aea5a4dbdc80f257539e801176fc0697a3b (patch) | |
tree | db52b0b203ea69e32fb3ea061ab35f0adf46b677 /src/bank-lib | |
parent | 0e73c0d4513a360ba3b5bcbe70ef4aeb59f68e3c (diff) |
adjust test to work with real bank (now fails)
Diffstat (limited to 'src/bank-lib')
-rw-r--r-- | src/bank-lib/bank_api_admin.c | 10 | ||||
-rw-r--r-- | src/bank-lib/test_bank_api.c | 15 |
2 files changed, 23 insertions, 2 deletions
diff --git a/src/bank-lib/bank_api_admin.c b/src/bank-lib/bank_api_admin.c index afafbc26f..9aa37c478 100644 --- a/src/bank-lib/bank_api_admin.c +++ b/src/bank-lib/bank_api_admin.c @@ -158,12 +158,22 @@ TALER_BANK_admin_add_incoming (struct GNUNET_CURL_Context *ctx, json_t *admin_obj; CURL *eh; + if (NULL == exchange_base_url) + { + GNUNET_break (0); + return NULL; + } admin_obj = json_pack ("{s:s, s:o, s:o, s:I, s:I}", "exchange_url", exchange_base_url, "wtid", GNUNET_JSON_from_data_auto (wtid), "amount", TALER_JSON_from_amount (amount), "debit_account", (json_int_t) debit_account_no, "credit_account", (json_int_t) credit_account_no); + if (NULL == admin_obj) + { + GNUNET_break (0); + return NULL; + } aai = GNUNET_new (struct TALER_BANK_AdminAddIncomingHandle); aai->cb = res_cb; aai->cb_cls = res_cb_cls; diff --git a/src/bank-lib/test_bank_api.c b/src/bank-lib/test_bank_api.c index ee85fa610..23407697e 100644 --- a/src/bank-lib/test_bank_api.c +++ b/src/bank-lib/test_bank_api.c @@ -48,12 +48,14 @@ run (void *cls) .details.history.num_results = 5 }, { .oc = TBI_OC_ADMIN_ADD_INCOMING, .label = "deposit-1", + .details.admin_add_incoming.exchange_base_url = "https://exchange.net/", /* bogus */ .details.admin_add_incoming.expected_response_code = MHD_HTTP_OK, .details.admin_add_incoming.credit_account_no = 1, .details.admin_add_incoming.debit_account_no = 2, .details.admin_add_incoming.amount = "PUDOS:5.01" }, { .oc = TBI_OC_ADMIN_ADD_INCOMING, .label = "deposit-2", + .details.admin_add_incoming.exchange_base_url = "https://exchange.net/", /* bogus */ .details.admin_add_incoming.expected_response_code = MHD_HTTP_OK, .details.admin_add_incoming.credit_account_no = 1, .details.admin_add_incoming.debit_account_no = 2, @@ -168,18 +170,27 @@ main (int argc, do { - fprintf (stderr, "."); + fprintf (stderr, ","); sleep (1); cnt++; if (cnt > 30) break; + result = system ("wget -q -t 1 -T 1 http://127.0.0.1:8081/admin/add/incoming -o /dev/null -O /dev/null"); } - while (0 != system ("wget -q -t 1 -T 1 http://127.0.0.1:8081/admin/add/incoming -o /dev/null -O /dev/null")); + while (! ( (WIFEXITED (result)) && + (8 == WEXITSTATUS (result)) ) ); + /* Note: we are using "GET", so /admin/add/incoming will yield a 405, which causes wget to return + a status code of 8. */ + fprintf (stderr, "\n"); result = GNUNET_SYSERR; if (cnt <= 30) + { + fprintf (stderr, + "Ready, running test...\n"); GNUNET_SCHEDULER_run (&run, &result); + } GNUNET_OS_process_kill (bankd, SIGTERM); GNUNET_OS_process_kill (bankd_admin, |