gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-merchant] branch master updated: towards expanding t


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] branch master updated: towards expanding testcase for #5258
Date: Fri, 19 Jan 2018 01:49:36 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new 54b7213  towards expanding testcase for #5258
54b7213 is described below

commit 54b7213f6ac4e08fad1fd3bec1b59658395575cb
Author: Christian Grothoff <address@hidden>
AuthorDate: Fri Jan 19 01:49:34 2018 +0100

    towards expanding testcase for #5258
---
 src/lib/test_merchant_api.c | 72 +++++++++++++++++++++++++++++++++------------
 1 file changed, 54 insertions(+), 18 deletions(-)

diff --git a/src/lib/test_merchant_api.c b/src/lib/test_merchant_api.c
index c9d26f4..5bc6814 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",

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]