introducing 'expected_response_code'
This commit is contained in:
parent
fdbedcd457
commit
8b91516fc3
@ -106,6 +106,11 @@ struct Command
|
||||
*/
|
||||
const char *label;
|
||||
|
||||
/**
|
||||
* Which response code do we expect for this command?
|
||||
*/
|
||||
unsigned int expected_response_code;
|
||||
|
||||
/**
|
||||
* Details about the command.
|
||||
*/
|
||||
@ -496,12 +501,15 @@ withdraw_status_cb (void *cls,
|
||||
struct TALER_Amount amount;
|
||||
|
||||
cmd->details.withdraw_status.wsh = NULL;
|
||||
if (MHD_HTTP_OK != http_status)
|
||||
if (cmd->expected_response_code != http_status)
|
||||
{
|
||||
GNUNET_break (0);
|
||||
fail (is);
|
||||
return;
|
||||
}
|
||||
switch (http_status)
|
||||
{
|
||||
case MHD_HTTP_OK:
|
||||
/* FIXME: note that history events may come in a different
|
||||
order than the commands right now... */
|
||||
j = 0;
|
||||
@ -567,6 +575,12 @@ withdraw_status_cb (void *cls,
|
||||
return;
|
||||
}
|
||||
}
|
||||
/* FIXME: support other status codes! */
|
||||
default:
|
||||
/* Unsupported status code (by test harness) */
|
||||
GNUNET_break (0);
|
||||
break;
|
||||
}
|
||||
is->ip++;
|
||||
is->task = GNUNET_SCHEDULER_add_now (&interpreter_run,
|
||||
is);
|
||||
@ -592,6 +606,15 @@ withdraw_sign_cb (void *cls,
|
||||
struct Command *cmd = &is->commands[is->ip];
|
||||
|
||||
cmd->details.withdraw_sign.wsh = NULL;
|
||||
if (cmd->expected_response_code != http_status)
|
||||
{
|
||||
GNUNET_break (0);
|
||||
fail (is);
|
||||
return;
|
||||
}
|
||||
switch (http_status)
|
||||
{
|
||||
case MHD_HTTP_OK:
|
||||
if (NULL == sig)
|
||||
{
|
||||
GNUNET_break (0);
|
||||
@ -600,6 +623,13 @@ withdraw_sign_cb (void *cls,
|
||||
}
|
||||
cmd->details.withdraw_sign.sig.rsa_signature
|
||||
= GNUNET_CRYPTO_rsa_signature_dup (sig->rsa_signature);
|
||||
break;
|
||||
/* FIXME: support other status codes here */
|
||||
default:
|
||||
/* Unsupported status code (by test harness) */
|
||||
GNUNET_break (0);
|
||||
break;
|
||||
}
|
||||
is->ip++;
|
||||
is->task = GNUNET_SCHEDULER_add_now (&interpreter_run,
|
||||
is);
|
||||
@ -624,7 +654,7 @@ deposit_cb (void *cls,
|
||||
struct Command *cmd = &is->commands[is->ip];
|
||||
|
||||
cmd->details.deposit.dh = NULL;
|
||||
if (MHD_HTTP_OK != http_status)
|
||||
if (cmd->expected_response_code != http_status)
|
||||
{
|
||||
GNUNET_break (0);
|
||||
fail (is);
|
||||
@ -1202,18 +1232,22 @@ run (void *cls,
|
||||
/* Fill reserve with EUR:5.01, as withdraw fee is 1 ct per config */
|
||||
{ .oc = OC_ADMIN_ADD_INCOMING,
|
||||
.label = "create-reserve-1",
|
||||
.expected_response_code = MHD_HTTP_OK,
|
||||
.details.admin_add_incoming.wire = "{ \"type\":\"TEST\", \"bank\":\"source bank\", \"account\":42 }",
|
||||
.details.admin_add_incoming.amount = "EUR:5.01" },
|
||||
{ .oc = OC_WITHDRAW_SIGN,
|
||||
.label = "withdraw-coin-1",
|
||||
.expected_response_code = MHD_HTTP_OK,
|
||||
.details.withdraw_sign.reserve_reference = "create-reserve-1",
|
||||
.details.withdraw_sign.amount = "EUR:5" },
|
||||
{ .oc = OC_WITHDRAW_STATUS,
|
||||
.label = "withdraw-status-1",
|
||||
.expected_response_code = MHD_HTTP_OK,
|
||||
.details.withdraw_status.reserve_reference = "create-reserve-1",
|
||||
.details.withdraw_status.expected_balance = "EUR:0" },
|
||||
{ .oc = OC_DEPOSIT,
|
||||
.label = "deposit-simple",
|
||||
.expected_response_code = MHD_HTTP_OK,
|
||||
.details.deposit.amount = "EUR:5",
|
||||
.details.deposit.coin_ref = "withdraw-coin-1",
|
||||
.details.deposit.wire_details = "{ \"type\":\"TEST\", \"bank\":\"dest bank\", \"account\":42 }",
|
||||
|
Loading…
Reference in New Issue
Block a user