added expected HTTP-code to logger
This commit is contained in:
parent
7e9f5324b7
commit
9d706a01a2
@ -57,18 +57,44 @@
|
||||
*
|
||||
* @param is interpreter to fail
|
||||
* @param status unexpected HTTP status code received
|
||||
* @param expected expected HTTP status code
|
||||
*/
|
||||
#define TALER_TESTING_unexpected_status(is,status) \
|
||||
#define TALER_TESTING_unexpected_status(is,status, expected) \
|
||||
do { \
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \
|
||||
"Unexpected response code %u to command %s in %s:%u\n", \
|
||||
"Unexpected response code %u (expected: %u) to command %s in %s:%u\n", \
|
||||
status, \
|
||||
expected, \
|
||||
TALER_TESTING_interpreter_get_current_label (is), \
|
||||
__FILE__, \
|
||||
__LINE__); \
|
||||
TALER_TESTING_interpreter_fail (is); \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* Log an error message about us receiving an unexpected HTTP
|
||||
* status code at the current command and fail the test and print the response
|
||||
* body (expected as json).
|
||||
*
|
||||
* @param is interpreter to fail
|
||||
* @param status unexpected HTTP status code received
|
||||
* @param expected expected HTTP status code
|
||||
* @param body received JSON-reply
|
||||
*/
|
||||
#define TALER_TESTING_unexpected_status_with_body(is,status, expected, body) \
|
||||
do { \
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \
|
||||
"Unexpected response code %u (expected: %u) to " \
|
||||
"command %s in %s:%u\nwith body:\n>>%s<<\n", \
|
||||
status, \
|
||||
expected, \
|
||||
TALER_TESTING_interpreter_get_current_label (is), \
|
||||
__FILE__, \
|
||||
__LINE__, \
|
||||
json_dumps (body, JSON_INDENT (2))); \
|
||||
TALER_TESTING_interpreter_fail (is); \
|
||||
} while (0)
|
||||
|
||||
|
||||
/**
|
||||
* Log an error message about a command not having
|
||||
|
@ -76,7 +76,8 @@ auditor_add_cb (
|
||||
if (ds->expected_response_code != hr->http_status)
|
||||
{
|
||||
TALER_TESTING_unexpected_status (ds->is,
|
||||
hr->http_status);
|
||||
hr->http_status,
|
||||
ds->expected_response_code);
|
||||
return;
|
||||
}
|
||||
TALER_TESTING_interpreter_next (ds->is);
|
||||
|
@ -81,7 +81,8 @@ denom_sig_add_cb (
|
||||
if (ds->expected_response_code != hr->http_status)
|
||||
{
|
||||
TALER_TESTING_unexpected_status (ds->is,
|
||||
hr->http_status);
|
||||
hr->http_status,
|
||||
ds->expected_response_code);
|
||||
return;
|
||||
}
|
||||
TALER_TESTING_interpreter_next (ds->is);
|
||||
|
@ -77,7 +77,8 @@ auditor_del_cb (
|
||||
if (ds->expected_response_code != hr->http_status)
|
||||
{
|
||||
TALER_TESTING_unexpected_status (ds->is,
|
||||
hr->http_status);
|
||||
hr->http_status,
|
||||
ds->expected_response_code);
|
||||
return;
|
||||
}
|
||||
TALER_TESTING_interpreter_next (ds->is);
|
||||
|
@ -170,7 +170,8 @@ deposit_confirmation_cb (
|
||||
}
|
||||
}
|
||||
TALER_TESTING_unexpected_status (dcs->is,
|
||||
hr->http_status);
|
||||
hr->http_status,
|
||||
dcs->expected_response_code);
|
||||
return;
|
||||
}
|
||||
TALER_TESTING_interpreter_next (dcs->is);
|
||||
|
@ -160,7 +160,8 @@ exchanges_cb (void *cls,
|
||||
}
|
||||
}
|
||||
TALER_TESTING_unexpected_status (es->is,
|
||||
hr->http_status);
|
||||
hr->http_status,
|
||||
es->expected_response_code);
|
||||
return;
|
||||
}
|
||||
if (MHD_HTTP_OK != hr->http_status)
|
||||
|
@ -199,7 +199,8 @@ confirmation_cb (void *cls,
|
||||
}
|
||||
}
|
||||
TALER_TESTING_unexpected_status (is,
|
||||
tr->http_status);
|
||||
tr->http_status,
|
||||
MHD_HTTP_OK);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -199,7 +199,8 @@ batch_deposit_cb (void *cls,
|
||||
if (ds->expected_response_code != dr->hr.http_status)
|
||||
{
|
||||
TALER_TESTING_unexpected_status (ds->is,
|
||||
dr->hr.http_status);
|
||||
dr->hr.http_status,
|
||||
ds->expected_response_code);
|
||||
return;
|
||||
}
|
||||
if (MHD_HTTP_OK == dr->hr.http_status)
|
||||
|
@ -190,7 +190,8 @@ reserve_batch_withdraw_cb (void *cls,
|
||||
if (ws->expected_response_code != wr->hr.http_status)
|
||||
{
|
||||
TALER_TESTING_unexpected_status (is,
|
||||
wr->hr.http_status);
|
||||
wr->hr.http_status,
|
||||
ws->expected_response_code);
|
||||
return;
|
||||
}
|
||||
switch (wr->hr.http_status)
|
||||
|
@ -80,7 +80,8 @@ check_aml_decision_cb (void *cls,
|
||||
if (ds->expected_http_status != adr->hr.http_status)
|
||||
{
|
||||
TALER_TESTING_unexpected_status (ds->is,
|
||||
adr->hr.http_status);
|
||||
adr->hr.http_status,
|
||||
ds->expected_http_status);
|
||||
return;
|
||||
}
|
||||
if (MHD_HTTP_OK == adr->hr.http_status)
|
||||
|
@ -80,7 +80,8 @@ check_aml_decisions_cb (void *cls,
|
||||
if (ds->expected_http_status != adr->hr.http_status)
|
||||
{
|
||||
TALER_TESTING_unexpected_status (ds->is,
|
||||
adr->hr.http_status);
|
||||
adr->hr.http_status,
|
||||
ds->expected_http_status);
|
||||
return;
|
||||
}
|
||||
TALER_TESTING_interpreter_next (ds->is);
|
||||
|
@ -77,7 +77,8 @@ keys_cb (void *cls,
|
||||
if (MHD_HTTP_OK != kr->hr.http_status)
|
||||
{
|
||||
TALER_TESTING_unexpected_status (cks->is,
|
||||
kr->hr.http_status);
|
||||
kr->hr.http_status,
|
||||
MHD_HTTP_OK);
|
||||
return;
|
||||
}
|
||||
cks->my_denom_date = kr->details.ok.keys->last_denom_issue_date;
|
||||
|
@ -102,7 +102,8 @@ get_cb (void *cls,
|
||||
if (ds->expected_response_code != dr->hr.http_status)
|
||||
{
|
||||
TALER_TESTING_unexpected_status (ds->is,
|
||||
dr->hr.http_status);
|
||||
dr->hr.http_status,
|
||||
ds->expected_response_code);
|
||||
return;
|
||||
}
|
||||
ref = TALER_TESTING_interpreter_lookup_command (ds->is,
|
||||
|
@ -248,8 +248,12 @@ deposit_cb (void *cls,
|
||||
return;
|
||||
}
|
||||
}
|
||||
TALER_TESTING_unexpected_status (ds->is,
|
||||
dr->hr.http_status);
|
||||
TALER_TESTING_unexpected_status_with_body (
|
||||
ds->is,
|
||||
dr->hr.http_status,
|
||||
ds->expected_response_code,
|
||||
dr->hr.reply);
|
||||
|
||||
return;
|
||||
}
|
||||
if (MHD_HTTP_OK == dr->hr.http_status)
|
||||
|
@ -117,7 +117,8 @@ deposit_wtid_cb (void *cls,
|
||||
if (tts->expected_response_code != dr->hr.http_status)
|
||||
{
|
||||
TALER_TESTING_unexpected_status (is,
|
||||
dr->hr.http_status);
|
||||
dr->hr.http_status,
|
||||
tts->expected_response_code);
|
||||
return;
|
||||
}
|
||||
switch (dr->hr.http_status)
|
||||
|
@ -83,7 +83,8 @@ version_cb (
|
||||
if (MHD_HTTP_OK != vr->hr.http_status)
|
||||
{
|
||||
TALER_TESTING_unexpected_status (gas->is,
|
||||
vr->hr.http_status);
|
||||
vr->hr.http_status,
|
||||
MHD_HTTP_OK);
|
||||
return;
|
||||
}
|
||||
if ( (NULL != gas->priv_file) &&
|
||||
|
@ -78,7 +78,8 @@ check_kyc_cb (void *cls,
|
||||
if (kcg->expected_response_code != ks->http_status)
|
||||
{
|
||||
TALER_TESTING_unexpected_status (is,
|
||||
ks->http_status);
|
||||
ks->http_status,
|
||||
kcg->expected_response_code);
|
||||
return;
|
||||
}
|
||||
switch (ks->http_status)
|
||||
|
@ -88,7 +88,8 @@ proof_kyc_cb (void *cls,
|
||||
if (kcg->expected_response_code != kpr->http_status)
|
||||
{
|
||||
TALER_TESTING_unexpected_status (is,
|
||||
kpr->http_status);
|
||||
kpr->http_status,
|
||||
kcg->expected_response_code);
|
||||
return;
|
||||
}
|
||||
switch (kpr->http_status)
|
||||
|
@ -109,7 +109,8 @@ wallet_kyc_cb (void *cls,
|
||||
if (kwg->expected_response_code != wkr->http_status)
|
||||
{
|
||||
TALER_TESTING_unexpected_status (is,
|
||||
wkr->http_status);
|
||||
wkr->http_status,
|
||||
kwg->expected_response_code);
|
||||
return;
|
||||
}
|
||||
switch (wkr->http_status)
|
||||
|
@ -163,7 +163,8 @@ deposit_cb (void *cls,
|
||||
if (ds->expected_response_code != dr->hr.http_status)
|
||||
{
|
||||
TALER_TESTING_unexpected_status (ds->is,
|
||||
dr->hr.http_status);
|
||||
dr->hr.http_status,
|
||||
ds->expected_response_code);
|
||||
return;
|
||||
}
|
||||
if (MHD_HTTP_OK == dr->hr.http_status)
|
||||
|
@ -75,7 +75,8 @@ purse_delete_cb (void *cls,
|
||||
if (pds->expected_response_code != pdr->hr.http_status)
|
||||
{
|
||||
TALER_TESTING_unexpected_status (pds->is,
|
||||
pdr->hr.http_status);
|
||||
pdr->hr.http_status,
|
||||
pds->expected_response_code);
|
||||
return;
|
||||
}
|
||||
TALER_TESTING_interpreter_next (pds->is);
|
||||
|
@ -138,7 +138,8 @@ deposit_cb (void *cls,
|
||||
if (ds->expected_response_code != dr->hr.http_status)
|
||||
{
|
||||
TALER_TESTING_unexpected_status (ds->is,
|
||||
dr->hr.http_status);
|
||||
dr->hr.http_status,
|
||||
ds->expected_response_code);
|
||||
return;
|
||||
}
|
||||
if (MHD_HTTP_OK == dr->hr.http_status)
|
||||
|
@ -178,7 +178,8 @@ merge_cb (void *cls,
|
||||
if (ds->expected_response_code != dr->hr.http_status)
|
||||
{
|
||||
TALER_TESTING_unexpected_status (ds->is,
|
||||
dr->hr.http_status);
|
||||
dr->hr.http_status,
|
||||
ds->expected_response_code);
|
||||
return;
|
||||
}
|
||||
TALER_TESTING_interpreter_next (ds->is);
|
||||
|
@ -90,7 +90,8 @@ recoup_cb (void *cls,
|
||||
if (ps->expected_response_code != hr->http_status)
|
||||
{
|
||||
TALER_TESTING_unexpected_status (is,
|
||||
hr->http_status);
|
||||
hr->http_status,
|
||||
ps->expected_response_code);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,8 @@ recoup_refresh_cb (void *cls,
|
||||
if (rrs->expected_response_code != hr->http_status)
|
||||
{
|
||||
TALER_TESTING_unexpected_status (is,
|
||||
hr->http_status);
|
||||
hr->http_status,
|
||||
rrs->expected_response_code);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -402,7 +402,8 @@ reveal_cb (void *cls,
|
||||
}
|
||||
}
|
||||
TALER_TESTING_unexpected_status (rrs->is,
|
||||
hr->http_status);
|
||||
hr->http_status,
|
||||
rrs->expected_response_code);
|
||||
return;
|
||||
}
|
||||
melt_cmd = TALER_TESTING_interpreter_lookup_command (rrs->is,
|
||||
@ -646,7 +647,8 @@ link_cb (void *cls,
|
||||
}
|
||||
}
|
||||
TALER_TESTING_unexpected_status (rls->is,
|
||||
hr->http_status);
|
||||
hr->http_status,
|
||||
rls->expected_response_code);
|
||||
return;
|
||||
}
|
||||
reveal_cmd = TALER_TESTING_interpreter_lookup_command (rls->is,
|
||||
@ -937,8 +939,10 @@ melt_cb (void *cls,
|
||||
return;
|
||||
}
|
||||
}
|
||||
TALER_TESTING_unexpected_status (rms->is,
|
||||
hr->http_status);
|
||||
TALER_TESTING_unexpected_status_with_body (rms->is,
|
||||
hr->http_status,
|
||||
rms->expected_response_code,
|
||||
hr->reply);
|
||||
return;
|
||||
}
|
||||
if (MHD_HTTP_OK == hr->http_status)
|
||||
|
@ -83,7 +83,8 @@ refund_cb (void *cls,
|
||||
if (rs->expected_response_code != hr->http_status)
|
||||
{
|
||||
TALER_TESTING_unexpected_status (rs->is,
|
||||
hr->http_status);
|
||||
hr->http_status,
|
||||
rs->expected_response_code);
|
||||
return;
|
||||
}
|
||||
TALER_TESTING_interpreter_next (rs->is);
|
||||
|
@ -154,7 +154,8 @@ purse_cb (void *cls,
|
||||
if (ds->expected_response_code != dr->hr.http_status)
|
||||
{
|
||||
TALER_TESTING_unexpected_status (ds->is,
|
||||
dr->hr.http_status);
|
||||
dr->hr.http_status,
|
||||
ds->expected_response_code);
|
||||
return;
|
||||
}
|
||||
switch (dr->hr.http_status)
|
||||
|
@ -79,7 +79,8 @@ success_cb (
|
||||
if (rs->expected_response_code != hr->http_status)
|
||||
{
|
||||
TALER_TESTING_unexpected_status (rs->is,
|
||||
hr->http_status);
|
||||
hr->http_status,
|
||||
rs->expected_response_code);
|
||||
return;
|
||||
}
|
||||
TALER_TESTING_interpreter_next (rs->is);
|
||||
|
@ -79,7 +79,8 @@ success_cb (
|
||||
if (rs->expected_response_code != hr->http_status)
|
||||
{
|
||||
TALER_TESTING_unexpected_status (rs->is,
|
||||
hr->http_status);
|
||||
hr->http_status,
|
||||
rs->expected_response_code);
|
||||
return;
|
||||
}
|
||||
TALER_TESTING_interpreter_next (rs->is);
|
||||
|
@ -98,7 +98,8 @@ set_officer_cb (void *cls,
|
||||
if (MHD_HTTP_NO_CONTENT != hr->http_status)
|
||||
{
|
||||
TALER_TESTING_unexpected_status (ds->is,
|
||||
hr->http_status);
|
||||
hr->http_status,
|
||||
MHD_HTTP_NO_CONTENT);
|
||||
return;
|
||||
}
|
||||
TALER_TESTING_interpreter_next (ds->is);
|
||||
|
@ -90,7 +90,8 @@ wire_add_cb (void *cls,
|
||||
if (ds->expected_response_code != hr->http_status)
|
||||
{
|
||||
TALER_TESTING_unexpected_status (ds->is,
|
||||
hr->http_status);
|
||||
hr->http_status,
|
||||
ds->expected_response_code);
|
||||
return;
|
||||
}
|
||||
TALER_TESTING_interpreter_next (ds->is);
|
||||
|
@ -108,7 +108,8 @@ take_aml_decision_cb (
|
||||
if (ds->expected_response != hr->http_status)
|
||||
{
|
||||
TALER_TESTING_unexpected_status (ds->is,
|
||||
hr->http_status);
|
||||
hr->http_status,
|
||||
ds->expected_response);
|
||||
return;
|
||||
}
|
||||
TALER_TESTING_interpreter_next (ds->is);
|
||||
|
@ -133,7 +133,8 @@ track_transfer_cb (void *cls,
|
||||
if (tts->expected_response_code != hr->http_status)
|
||||
{
|
||||
TALER_TESTING_unexpected_status (is,
|
||||
hr->http_status);
|
||||
hr->http_status,
|
||||
tts->expected_response_code);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,8 @@ wire_add_cb (void *cls,
|
||||
if (ds->expected_response_code != hr->http_status)
|
||||
{
|
||||
TALER_TESTING_unexpected_status (ds->is,
|
||||
hr->http_status);
|
||||
hr->http_status,
|
||||
ds->expected_response_code);
|
||||
return;
|
||||
}
|
||||
TALER_TESTING_interpreter_next (ds->is);
|
||||
|
@ -80,7 +80,9 @@ wire_del_cb (void *cls,
|
||||
if (ds->expected_response_code != hr->http_status)
|
||||
{
|
||||
TALER_TESTING_unexpected_status (ds->is,
|
||||
hr->http_status);
|
||||
hr->http_status,
|
||||
ds->expected_response_code);
|
||||
|
||||
return;
|
||||
}
|
||||
TALER_TESTING_interpreter_next (ds->is);
|
||||
|
@ -284,7 +284,8 @@ reserve_withdraw_cb (void *cls,
|
||||
}
|
||||
}
|
||||
TALER_TESTING_unexpected_status (is,
|
||||
wr->hr.http_status);
|
||||
wr->hr.http_status,
|
||||
ws->expected_response_code);
|
||||
return;
|
||||
}
|
||||
switch (wr->hr.http_status)
|
||||
|
Loading…
Reference in New Issue
Block a user