adjust test to work with real bank (now fails)
This commit is contained in:
parent
0e73c0d451
commit
56786aea5a
@ -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;
|
||||||
|
@ -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,
|
||||||
|
@ -48,7 +48,7 @@ TEH_RESPONSE_add_global_headers (struct MHD_Response *response)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is HTTP body deflate compression supported by the client?
|
* Is HTTP body deflate compression supported by the client?
|
||||||
*
|
*
|
||||||
* @param connection connection to check
|
* @param connection connection to check
|
||||||
@ -75,7 +75,7 @@ TEH_RESPONSE_can_compress (struct MHD_Connection *connection)
|
|||||||
( (de[strlen ("deflate")] == '\0') ||
|
( (de[strlen ("deflate")] == '\0') ||
|
||||||
(de[strlen ("deflate")] == ',') ) )
|
(de[strlen ("deflate")] == ',') ) )
|
||||||
return MHD_YES;
|
return MHD_YES;
|
||||||
return MHD_NO;
|
return MHD_NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -525,7 +525,7 @@ static json_t *
|
|||||||
compile_transaction_history (const struct TALER_EXCHANGEDB_TransactionList *tl)
|
compile_transaction_history (const struct TALER_EXCHANGEDB_TransactionList *tl)
|
||||||
{
|
{
|
||||||
json_t *history;
|
json_t *history;
|
||||||
|
|
||||||
history = json_array ();
|
history = json_array ();
|
||||||
if (NULL == history)
|
if (NULL == history)
|
||||||
{
|
{
|
||||||
@ -650,7 +650,7 @@ compile_transaction_history (const struct TALER_EXCHANGEDB_TransactionList *tl)
|
|||||||
json_decref (history);
|
json_decref (history);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
GNUNET_assert (0 ==
|
GNUNET_assert (0 ==
|
||||||
json_array_append_new (history,
|
json_array_append_new (history,
|
||||||
json_pack ("{s:s, s:o, s:o, s:o, s:o, s:I, s:o}",
|
json_pack ("{s:s, s:o, s:o, s:o, s:o, s:I, s:o}",
|
||||||
@ -779,7 +779,7 @@ compile_reserve_history (const struct TALER_EXCHANGEDB_ReserveHistory *rh,
|
|||||||
{
|
{
|
||||||
struct GNUNET_HashCode h_denom_pub;
|
struct GNUNET_HashCode h_denom_pub;
|
||||||
struct TALER_Amount value;
|
struct TALER_Amount value;
|
||||||
|
|
||||||
value = pos->details.withdraw->amount_with_fee;
|
value = pos->details.withdraw->amount_with_fee;
|
||||||
if (0 == (2 & ret))
|
if (0 == (2 & ret))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user