expanding test to cover multi-wire format scenarios (#3972)
This commit is contained in:
parent
a6f8fa98b0
commit
16ed21afe0
@ -2,7 +2,8 @@
|
|||||||
# Currency supported by the mint (can only be one)
|
# Currency supported by the mint (can only be one)
|
||||||
CURRENCY = EUR
|
CURRENCY = EUR
|
||||||
|
|
||||||
# Wire format supported by the mint (currently only SEPA is implemented)
|
# Wire format supported by the mint, case-insensitive.
|
||||||
|
# Examples for formats include 'test' for testing and 'sepa' (for EU IBAN).
|
||||||
WIREFORMAT = SEPA
|
WIREFORMAT = SEPA
|
||||||
|
|
||||||
# HTTP port the mint listens to
|
# HTTP port the mint listens to
|
||||||
|
@ -289,7 +289,8 @@ handle_wire_method_finished (void *cls,
|
|||||||
/* pass on successful reply */
|
/* pass on successful reply */
|
||||||
wh->cb (wh->cb_cls,
|
wh->cb (wh->cb_cls,
|
||||||
response_code,
|
response_code,
|
||||||
NULL,
|
json_string_value (json_array_get (wh->methods,
|
||||||
|
wh->methods_off-1)),
|
||||||
json);
|
json);
|
||||||
/* trigger request for the next /wire/method */
|
/* trigger request for the next /wire/method */
|
||||||
request_wire_method (wh);
|
request_wire_method (wh);
|
||||||
|
@ -3,11 +3,9 @@
|
|||||||
CURRENCY = EUR
|
CURRENCY = EUR
|
||||||
|
|
||||||
# Wire format supported by the mint
|
# Wire format supported by the mint
|
||||||
# We use 'test' for testing, in principle we should
|
# We use 'test' for testing of the actual
|
||||||
# run tests for all supported wire formats...
|
# coin operations, and 'sepa' to test SEPA-specific routines.
|
||||||
# (we should first implement support for a mint running
|
WIREFORMAT = test sepa
|
||||||
# with multiple formats at the same time).
|
|
||||||
WIREFORMAT = test
|
|
||||||
|
|
||||||
# HTTP port the mint listens to
|
# HTTP port the mint listens to
|
||||||
PORT = 8081
|
PORT = 8081
|
||||||
|
@ -33,9 +33,8 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the configuration file is set to include wire format 'sepa'?
|
* Is the configuration file is set to include wire format 'sepa'?
|
||||||
* Needs #3972 to be solved first.
|
|
||||||
*/
|
*/
|
||||||
#define WIRE_SEPA 0
|
#define WIRE_SEPA 1
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main execution context for the main loop.
|
* Main execution context for the main loop.
|
||||||
@ -464,6 +463,11 @@ struct Command
|
|||||||
*/
|
*/
|
||||||
struct TALER_MINT_WireHandle *wh;
|
struct TALER_MINT_WireHandle *wh;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format we expect to see, others will be *ignored*.
|
||||||
|
*/
|
||||||
|
const char *format;
|
||||||
|
|
||||||
} wire;
|
} wire;
|
||||||
|
|
||||||
} details;
|
} details;
|
||||||
@ -1038,10 +1042,6 @@ link_cb (void *cls,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* check that the coins match */
|
/* check that the coins match */
|
||||||
fprintf (stderr,
|
|
||||||
"Got %u coins\n",
|
|
||||||
num_coins);
|
|
||||||
|
|
||||||
for (i=0;i<num_coins;i++)
|
for (i=0;i<num_coins;i++)
|
||||||
for (j=i+1;j<num_coins;j++)
|
for (j=i+1;j<num_coins;j++)
|
||||||
if (0 == memcmp (&coin_privs[i],
|
if (0 == memcmp (&coin_privs[i],
|
||||||
@ -1186,6 +1186,13 @@ wire_cb (void *cls,
|
|||||||
/* 0 always signals the end of the iteration */
|
/* 0 always signals the end of the iteration */
|
||||||
cmd->details.wire.wh = NULL;
|
cmd->details.wire.wh = NULL;
|
||||||
}
|
}
|
||||||
|
else if ( (NULL != method) &&
|
||||||
|
(0 != strcasecmp (method,
|
||||||
|
cmd->details.wire.format)) )
|
||||||
|
{
|
||||||
|
/* not the method we care about, skip */
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (cmd->expected_response_code != http_status)
|
if (cmd->expected_response_code != http_status)
|
||||||
{
|
{
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
||||||
@ -1994,13 +2001,15 @@ run (void *cls,
|
|||||||
{ .oc = OC_WIRE,
|
{ .oc = OC_WIRE,
|
||||||
.label = "wire-test",
|
.label = "wire-test",
|
||||||
/* /wire/test replies with a 302 redirect */
|
/* /wire/test replies with a 302 redirect */
|
||||||
.expected_response_code = MHD_HTTP_FOUND },
|
.expected_response_code = MHD_HTTP_FOUND,
|
||||||
|
.details.wire.format = "test" },
|
||||||
#endif
|
#endif
|
||||||
#if WIRE_SEPA
|
#if WIRE_SEPA
|
||||||
{ .oc = OC_WIRE,
|
{ .oc = OC_WIRE,
|
||||||
.label = "wire-sepa",
|
.label = "wire-sepa",
|
||||||
/* /wire/sepa replies with a 200 redirect */
|
/* /wire/sepa replies with a 200 redirect */
|
||||||
.expected_response_code = MHD_HTTP_OK },
|
.expected_response_code = MHD_HTTP_OK,
|
||||||
|
.details.wire.format = "sepa" },
|
||||||
#endif
|
#endif
|
||||||
/* *************** end of /wire testing ************** */
|
/* *************** end of /wire testing ************** */
|
||||||
|
|
||||||
|
@ -66,11 +66,6 @@ TMH_WIRE_handler_wire (struct TMH_RequestHandler *rh,
|
|||||||
TMH_KS_sign (&wsm.purpose,
|
TMH_KS_sign (&wsm.purpose,
|
||||||
&pub,
|
&pub,
|
||||||
&sig);
|
&sig);
|
||||||
/* NOTE: for now, we only support *ONE* wire format per
|
|
||||||
mint instance; if we supply multiple, we need to
|
|
||||||
add the strings for each type separately here -- and
|
|
||||||
hash the 0-terminated strings above differently as well...
|
|
||||||
See #3972. */
|
|
||||||
return TMH_RESPONSE_reply_json_pack (connection,
|
return TMH_RESPONSE_reply_json_pack (connection,
|
||||||
MHD_HTTP_OK,
|
MHD_HTTP_OK,
|
||||||
"{s:o, s:o, s:o}",
|
"{s:o, s:o, s:o}",
|
||||||
|
Loading…
Reference in New Issue
Block a user