summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-01-19 01:49:34 +0100
committerChristian Grothoff <christian@grothoff.org>2018-01-19 01:49:34 +0100
commit54b7213f6ac4e08fad1fd3bec1b59658395575cb (patch)
tree3f0ae6261ca8a516cd3a46357155c1b9dfff77c1 /src
parent2610e6601347996fce02232fc22a6eadadbc5fd1 (diff)
downloadmerchant-54b7213f6ac4e08fad1fd3bec1b59658395575cb.tar.gz
merchant-54b7213f6ac4e08fad1fd3bec1b59658395575cb.tar.bz2
merchant-54b7213f6ac4e08fad1fd3bec1b59658395575cb.zip
towards expanding testcase for #5258
Diffstat (limited to 'src')
-rw-r--r--src/lib/test_merchant_api.c72
1 files changed, 54 insertions, 18 deletions
diff --git a/src/lib/test_merchant_api.c b/src/lib/test_merchant_api.c
index c9d26f4d..5bc6814d 100644
--- a/src/lib/test_merchant_api.c
+++ b/src/lib/test_merchant_api.c
@@ -945,6 +945,12 @@ struct Command
const char *authorize_ref;
/**
+ * Set to non-NULL to a label of another pick up operation
+ * that we should replay.
+ */
+ const char *replay_ref;
+
+ /**
* Number of coins we pick up.
*/
unsigned int num_coins;
@@ -3713,38 +3719,60 @@ interpreter_run (void *cls)
case OC_TIP_PICKUP:
{
unsigned int num_planchets;
+ const struct Command *rr;
- for (num_planchets=0;
- NULL != cmd->details.tip_pickup.amounts[num_planchets];
- num_planchets++);
- cmd->details.tip_pickup.num_coins = num_planchets;
+ if (NULL == cmd->details.tip_pickup.replay_ref)
{
- struct TALER_PlanchetDetail planchets[num_planchets];
-
+ rr = NULL;
+ for (num_planchets=0;
+ NULL != cmd->details.tip_pickup.amounts[num_planchets];
+ num_planchets++);
ref = find_command (is,
cmd->details.tip_pickup.authorize_ref);
GNUNET_assert (NULL != ref);
GNUNET_assert (OC_TIP_AUTHORIZE == ref->oc);
+ }
+ else
+ {
+ rr = find_command (is,
+ cmd->details.tip_pickup.replay_ref);
+ GNUNET_assert (NULL != rr);
+ GNUNET_assert (OC_TIP_PICKUP == rr->oc);
+ num_planchets = rr->details.tip_pickup.num_coins;
+ }
+ cmd->details.tip_pickup.num_coins = num_planchets;
+ {
+ struct TALER_PlanchetDetail planchets[num_planchets];
+
cmd->details.tip_pickup.psa = GNUNET_new_array (num_planchets,
struct TALER_PlanchetSecretsP);
cmd->details.tip_pickup.dks = GNUNET_new_array (num_planchets,
const struct TALER_EXCHANGE_DenomPublicKey *);
for (unsigned int i=0;i<num_planchets;i++)
{
- GNUNET_assert (GNUNET_OK ==
- TALER_string_to_amount (cmd->details.tip_pickup.amounts[i],
- &amount));
-
- cmd->details.tip_pickup.dks[i]
- = find_pk (is->keys,
- &amount);
- if (NULL == cmd->details.tip_pickup.dks[i])
+ if (NULL == rr)
{
- GNUNET_break (0);
- fail (is);
- return;
+ GNUNET_assert (GNUNET_OK ==
+ TALER_string_to_amount (cmd->details.tip_pickup.amounts[i],
+ &amount));
+ cmd->details.tip_pickup.dks[i]
+ = find_pk (is->keys,
+ &amount);
+ if (NULL == cmd->details.tip_pickup.dks[i])
+ {
+ GNUNET_break (0);
+ fail (is);
+ return;
+ }
+ TALER_planchet_setup_random (&cmd->details.tip_pickup.psa[i]);
+ }
+ else
+ {
+ cmd->details.tip_pickup.dks[i]
+ = rr->details.tip_pickup.dks[i];
+ cmd->details.tip_pickup.psa[i]
+ = rr->details.tip_pickup.psa[i];
}
- TALER_planchet_setup_random (&cmd->details.tip_pickup.psa[i]);
if (GNUNET_OK !=
TALER_planchet_prepare (&cmd->details.tip_pickup.dks[i]->key,
&cmd->details.tip_pickup.psa[i],
@@ -4299,6 +4327,14 @@ run (void *cls)
.expected_response_code = MHD_HTTP_OK,
.details.tip_pickup.authorize_ref = "authorize-tip-2",
.details.tip_pickup.amounts = pickup_amounts_1 },
+#if B5258
+ { .oc = OC_TIP_PICKUP,
+ .label = "pickup-tip-2b",
+ .expected_response_code = MHD_HTTP_OK,
+ .details.tip_pickup.replay_ref = "pickup-tip-2",
+ .details.tip_pickup.authorize_ref = "authorize-tip-2",
+ .details.tip_pickup.amounts = pickup_amounts_1 },
+#endif
/* Test authorization failure modes */
{ .oc = OC_TIP_AUTHORIZE,
.label = "authorize-tip-3-insufficient-funds",