adjust test to work with real bank (now fails)

This commit is contained in:
Christian Grothoff 2017-05-07 14:21:40 +02:00
parent 0e73c0d451
commit 56786aea5a
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
3 changed files with 28 additions and 7 deletions

View File

@ -158,12 +158,22 @@ TALER_BANK_admin_add_incoming (struct GNUNET_CURL_Context *ctx,
json_t *admin_obj; json_t *admin_obj;
CURL *eh; 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}", admin_obj = json_pack ("{s:s, s:o, s:o, s:I, s:I}",
"exchange_url", exchange_base_url, "exchange_url", exchange_base_url,
"wtid", GNUNET_JSON_from_data_auto (wtid), "wtid", GNUNET_JSON_from_data_auto (wtid),
"amount", TALER_JSON_from_amount (amount), "amount", TALER_JSON_from_amount (amount),
"debit_account", (json_int_t) debit_account_no, "debit_account", (json_int_t) debit_account_no,
"credit_account", (json_int_t) credit_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 = GNUNET_new (struct TALER_BANK_AdminAddIncomingHandle);
aai->cb = res_cb; aai->cb = res_cb;
aai->cb_cls = res_cb_cls; aai->cb_cls = res_cb_cls;

View File

@ -48,12 +48,14 @@ run (void *cls)
.details.history.num_results = 5 }, .details.history.num_results = 5 },
{ .oc = TBI_OC_ADMIN_ADD_INCOMING, { .oc = TBI_OC_ADMIN_ADD_INCOMING,
.label = "deposit-1", .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.expected_response_code = MHD_HTTP_OK,
.details.admin_add_incoming.credit_account_no = 1, .details.admin_add_incoming.credit_account_no = 1,
.details.admin_add_incoming.debit_account_no = 2, .details.admin_add_incoming.debit_account_no = 2,
.details.admin_add_incoming.amount = "PUDOS:5.01" }, .details.admin_add_incoming.amount = "PUDOS:5.01" },
{ .oc = TBI_OC_ADMIN_ADD_INCOMING, { .oc = TBI_OC_ADMIN_ADD_INCOMING,
.label = "deposit-2", .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.expected_response_code = MHD_HTTP_OK,
.details.admin_add_incoming.credit_account_no = 1, .details.admin_add_incoming.credit_account_no = 1,
.details.admin_add_incoming.debit_account_no = 2, .details.admin_add_incoming.debit_account_no = 2,
@ -168,18 +170,27 @@ main (int argc,
do do
{ {
fprintf (stderr, "."); fprintf (stderr, ",");
sleep (1); sleep (1);
cnt++; cnt++;
if (cnt > 30) if (cnt > 30)
break; 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"); fprintf (stderr, "\n");
result = GNUNET_SYSERR; result = GNUNET_SYSERR;
if (cnt <= 30) if (cnt <= 30)
{
fprintf (stderr,
"Ready, running test...\n");
GNUNET_SCHEDULER_run (&run, &result); GNUNET_SCHEDULER_run (&run, &result);
}
GNUNET_OS_process_kill (bankd, GNUNET_OS_process_kill (bankd,
SIGTERM); SIGTERM);
GNUNET_OS_process_kill (bankd_admin, GNUNET_OS_process_kill (bankd_admin,