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: Tip pick up on a no


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] branch master updated: Tip pick up on a non existent tip id. (Closes #5307)
Date: Tue, 22 May 2018 11:11:19 +0200

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

marcello pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new 7ada0ce  Tip pick up on a non existent tip id. (Closes #5307)
7ada0ce is described below

commit 7ada0ceb3ad58915ea677c75ba835cbb31f66828
Author: Marcello Stanisci <address@hidden>
AuthorDate: Tue May 22 11:10:19 2018 +0200

    Tip pick up on a non existent tip id. (Closes #5307)
---
 src/include/taler_merchant_testing_lib.h |  3 +++
 src/lib/test_merchant_api_new.c          | 14 +++++++++++-
 src/lib/testing_api_cmd_tip.c            | 37 ++++++++++++++++++++++++++++++++
 3 files changed, 53 insertions(+), 1 deletion(-)

diff --git a/src/include/taler_merchant_testing_lib.h 
b/src/include/taler_merchant_testing_lib.h
index 357a223..406891f 100644
--- a/src/include/taler_merchant_testing_lib.h
+++ b/src/include/taler_merchant_testing_lib.h
@@ -527,6 +527,9 @@ TALER_TESTING_cmd_tip_authorize_with_ec
    const char *amount,
    enum TALER_ErrorCode ec);
 
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_tip_authorize_fake
+  (const char *label);
 
 /**
  * FIXME
diff --git a/src/lib/test_merchant_api_new.c b/src/lib/test_merchant_api_new.c
index 6d5ed02..b9028cf 100644
--- a/src/lib/test_merchant_api_new.c
+++ b/src/lib/test_merchant_api_new.c
@@ -732,7 +732,6 @@ run (void *cls,
        "EUR:5.01",
        TALER_EC_TIP_AUTHORIZE_INSTANCE_DOES_NOT_TIP),
 
-
     TALER_TESTING_cmd_tip_pickup_with_ec
       ("pickup-tip-3-too-much",
        merchant_url,
@@ -743,6 +742,19 @@ run (void *cls,
        is->exchange,
        TALER_EC_TIP_PICKUP_NO_FUNDS),
 
+    TALER_TESTING_cmd_tip_authorize_fake
+      ("fake-tip-authorization"),
+
+    TALER_TESTING_cmd_tip_pickup_with_ec
+      ("pickup-non-existent-id",
+       merchant_url,
+       is->ctx,
+       MHD_HTTP_NOT_FOUND,
+       "fake-tip-authorization",
+       pickup_amounts_1,
+       is->exchange,
+       TALER_EC_TIP_PICKUP_TIP_ID_UNKNOWN),
+
     TALER_TESTING_cmd_proposal
       ("create-proposal-tip-1",
        merchant_url,
diff --git a/src/lib/testing_api_cmd_tip.c b/src/lib/testing_api_cmd_tip.c
index e9443e8..306b52f 100644
--- a/src/lib/testing_api_cmd_tip.c
+++ b/src/lib/testing_api_cmd_tip.c
@@ -278,6 +278,21 @@ tip_authorize_run (void *cls,
 }
 
 
+static void
+tip_authorize_fake_run (void *cls,
+                        const struct TALER_TESTING_Command *cmd,
+                        struct TALER_TESTING_Interpreter *is)
+{
+  struct TipAuthorizeState *tas = cls;
+
+  GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
+                              &tas->tip_id,
+                              sizeof (struct GNUNET_HashCode));
+
+  TALER_TESTING_interpreter_next (is);
+}
+
+
 /**
  * FIXME
  */
@@ -957,5 +972,27 @@ TALER_TESTING_cmd_tip_pickup
   return cmd;
 }
 
+/**
+ * This commands does not query the backend at all,
+ * but just makes up a fake authorization id that will
+ * be subsequently used by the "pick up" CMD in order
+ * to test against such a case.
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_tip_authorize_fake (const char *label)
+{
+  struct TipAuthorizeState *tas;
+  struct TALER_TESTING_Command cmd;
+
+  tas = GNUNET_new (struct TipAuthorizeState);
+
+  cmd.label = label;
+  cmd.cls = tas;
+  cmd.run = &tip_authorize_fake_run;
+  cmd.cleanup = &tip_authorize_cleanup;
+  cmd.traits = &tip_authorize_traits;
+  
+  return cmd;
+}
 
 /* end of testing_api_cmd_tip.c */

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



reply via email to

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