gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-merchant] 06/12: putting tip-pickup under test.


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] 06/12: putting tip-pickup under test.
Date: Mon, 26 Mar 2018 10:38:00 +0200

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

marcello pushed a commit to branch master
in repository merchant.

commit 68436afb0324ab62ad4ccce04ca5eee07a19e498
Author: Marcello Stanisci <address@hidden>
AuthorDate: Fri Mar 23 12:55:21 2018 +0100

    putting tip-pickup under test.
---
 src/lib/test_merchant_api_new.c | 14 +++++++++++++-
 src/lib/testing_api_cmd_tip.c   | 35 ++++++++++++++++++++++++++++++++++-
 2 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/src/lib/test_merchant_api_new.c b/src/lib/test_merchant_api_new.c
index 2b8e75d..cd05677 100644
--- a/src/lib/test_merchant_api_new.c
+++ b/src/lib/test_merchant_api_new.c
@@ -48,6 +48,8 @@
  */
 #define EXCHANGE_URL "http://localhost:8081/";
 
+static const char *pickup_amounts_1[] = {"EUR:5", NULL};
+
 /**
  * URL of the fakebank.  Obtained from CONFIG_FILE's
  * "exchange-wire-test:BANK_URI" option.
@@ -511,6 +513,15 @@ run (void *cls,
                                               "EUR:0.0", // picked
                                               "EUR:10.02", // auth
                                               "EUR:20.04"),// ava
+
+    TALER_TESTING_cmd_tip_pickup ("pickup-tip-1",
+                                  merchant_url,
+                                  is->ctx,
+                                  MHD_HTTP_OK,
+                                  "authorize-tip-1",
+                                  pickup_amounts_1,
+                                  is->exchange),
+
     /* Will fail here until all new
      * transfers have not been checked.  I.e.,
      * there is now a 20.04 euro "pending" transfer.  */
@@ -737,7 +748,8 @@ main (int argc,
     ret = TALER_TESTING_setup_with_exchange (&run,
                                              NULL,
                                              CONFIG_FILE);
-    GNUNET_OS_process_kill (merchantd, SIGKILL); 
+
+    GNUNET_OS_process_kill (merchantd, SIGTERM); 
     GNUNET_OS_process_wait (merchantd); 
     GNUNET_OS_process_destroy (merchantd); 
     GNUNET_free (merchant_url);
diff --git a/src/lib/testing_api_cmd_tip.c b/src/lib/testing_api_cmd_tip.c
index 80722ba..eb87034 100644
--- a/src/lib/testing_api_cmd_tip.c
+++ b/src/lib/testing_api_cmd_tip.c
@@ -194,6 +194,37 @@ tip_authorize_cb (void *cls,
   TALER_TESTING_interpreter_next (tas->is);
 }
 
+/**
+ * Extract information from a command that is useful for other
+ * commands.
+ *
+ * @param cls closure
+ * @param ret[out] result (could be anything)
+ * @param trait name of the trait
+ * @param selector more detailed information about which object
+ *                 to return in case there were multiple generated
+ *                 by the command
+ * @return #GNUNET_OK on success
+ */
+static int
+tip_authorize_traits (void *cls,
+                      void **ret,
+                      const char *trait,
+                      unsigned int index)
+{
+  struct TipAuthorizeState *tas = cls;
+
+  struct TALER_TESTING_Trait traits[] = {
+    TALER_TESTING_make_trait_tip_id (0, &tas->tip_id),
+    TALER_TESTING_trait_end (),
+  };
+
+  return TALER_TESTING_get_trait (traits,
+                                  ret,
+                                  trait,
+                                  index);
+  return GNUNET_SYSERR;
+}
 
 /**
  * Runs the command.  Note that upon return, the interpreter
@@ -281,6 +312,7 @@ TALER_TESTING_cmd_tip_authorize (const char *label,
   cmd.cls = tas;
   cmd.run = &tip_authorize_run;
   cmd.cleanup = &tip_authorize_cleanup;
+  cmd.traits = &tip_authorize_traits;
   
   return cmd;
 }
@@ -593,7 +625,6 @@ pickup_cb (void *cls,
   if (num_reserve_sigs != tps->num_coins)
     TALER_TESTING_FAIL (tps->is);
 
-
   /* pickup successful, now withdraw! */
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Obtained %u signatures for withdrawal"
@@ -633,6 +664,7 @@ tip_pickup_run (void *cls,
                 const struct TALER_TESTING_Command *cmd,
                 struct TALER_TESTING_Interpreter *is)
 {
+
   struct TipPickupState *tps = cls;
   unsigned int num_planchets;
   const struct TALER_TESTING_Command *replay_cmd;
@@ -801,6 +833,7 @@ TALER_TESTING_cmd_tip_pickup
   tps->authorize_reference = authorize_reference;
   tps->amounts = amounts;
   tps->exchange = exchange;
+  tps->http_status = http_status;
 
   cmd.cls = tps;
   cmd.label = label;

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



reply via email to

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