gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated: fix api test


From: gnunet
Subject: [taler-anastasis] branch master updated: fix api test
Date: Mon, 13 Apr 2020 18:37:39 +0200

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

dennis-neufeld pushed a commit to branch master
in repository anastasis.

The following commit(s) were added to refs/heads/master by this push:
     new 0589aeb  fix api test
0589aeb is described below

commit 0589aeb689e4226bbe8096a2c852dd07ed879b51
Author: Dennis Neufeld <address@hidden>
AuthorDate: Mon Apr 13 16:16:14 2020 +0000

    fix api test
---
 src/include/anastasis_testing_lib.h   | 11 ++++++-----
 src/lib/test_anastasis_api.c          | 13 ++++---------
 src/lib/testing_api_cmd_truth_store.c | 24 ++++++++++++------------
 3 files changed, 22 insertions(+), 26 deletions(-)

diff --git a/src/include/anastasis_testing_lib.h 
b/src/include/anastasis_testing_lib.h
index be8d429..a9d9962 100644
--- a/src/include/anastasis_testing_lib.h
+++ b/src/include/anastasis_testing_lib.h
@@ -323,10 +323,13 @@ enum ANASTASIS_TESTING_TruthStoreOption
 /**
  * Creates a sample of truth.
  *
+ * @param method the challenge method
+ * @param mime_type mime type of the truth
  * @return truth in json format
  */
-json_t
-ANASTASIS_TESTING_get_truth_example ();
+json_t*
+ANASTASIS_TESTING_make_truth_example (char *method,
+                                      char *mime_type);
 
 /**
  * Make the "truth store" command.
@@ -336,7 +339,6 @@ ANASTASIS_TESTING_get_truth_example ();
  *        the truth store request.
  * @param http_status expected HTTP status.
  * @param truth_data recovery data to post /truth
- * @param truth_data_size size of truth data
  * @return the command
  */
 struct TALER_TESTING_Command
@@ -346,8 +348,7 @@ ANASTASIS_TESTING_cmd_truth_store (const char *label,
                                    unsigned int http_status,
                                    enum
                                    ANASTASIS_TESTING_TruthStoreOption tso,
-                                   json_t *truth_data,
-                                   size_t truth_data_size);
+                                   json_t *truth_data);
 
 /**
  * Make the "truth lookup" command.
diff --git a/src/lib/test_anastasis_api.c b/src/lib/test_anastasis_api.c
index a73781d..ed81e12 100644
--- a/src/lib/test_anastasis_api.c
+++ b/src/lib/test_anastasis_api.c
@@ -76,11 +76,6 @@ static struct TALER_TESTING_BankConfiguration bc;
  */
 static struct TALER_TESTING_ExchangeConfiguration ec;
 
-/**
- * Truth data
- */
-static json_t truth_data;
-
 /**
  * Payto URI of the customer (payer).
  */
@@ -116,6 +111,7 @@ static struct GNUNET_OS_Process *merchantd;
  */
 static struct GNUNET_OS_Process *anastasisd;
 
+
 /**
  * Execute the taler-exchange-wirewatch command with
  * our configuration file.
@@ -239,8 +235,6 @@ run (void *cls,
     TALER_TESTING_cmd_end ()
   };
 
-  truth_data = ANASTASIS_TESTING_get_truth_example ();
-
   struct TALER_TESTING_Command truth[] = {
     // FIXME: Code for truth handling
 
@@ -249,8 +243,9 @@ run (void *cls,
                                        NULL,
                                        MHD_HTTP_NO_CONTENT,
                                        ANASTASIS_TESTING_TSO_NONE,
-                                       &truth_data,
-                                       sizeof (&truth_data)),
+                                       ANASTASIS_TESTING_make_truth_example (
+                                         "Truth method",
+                                         "Truth mime")),
     TALER_TESTING_cmd_end ()
   };
 
diff --git a/src/lib/testing_api_cmd_truth_store.c 
b/src/lib/testing_api_cmd_truth_store.c
index 3f89242..81a502c 100644
--- a/src/lib/testing_api_cmd_truth_store.c
+++ b/src/lib/testing_api_cmd_truth_store.c
@@ -373,13 +373,17 @@ truth_store_traits (void *cls,
                                   index);
 }
 
+
 /**
  * Creates a sample of truth.
  *
+ * @param method the challenge method
+ * @param mime_type mime type of the truth
  * @return truth in json format
  */
-json_t
-ANASTASIS_TESTING_get_truth_example ()
+json_t*
+ANASTASIS_TESTING_make_truth_example (char *method,
+                                      char *mime_type)
 {
 
   json_t *truth_data;
@@ -412,25 +416,23 @@ ANASTASIS_TESTING_get_truth_example ()
                           " s:s}", /* truth_mime */
                           "keyshare_data", GNUNET_JSON_from_data_auto (
                             &keyshare_data),
-                          "method", "Truth test method",
+                          "method", method,
                           "nonce", GNUNET_JSON_from_data_auto (&nonce),
                           "aes_gcm_tag", GNUNET_JSON_from_data_auto (
                             &aes_gcm_tag),
                           "encrypted_truth", GNUNET_JSON_from_data (
                             encrypted_truth, strlen (encrypted_truth)),
-                          "truth_mime", "Truth test mime"
+                          "truth_mime", mime_type
                           );
-  if (NULL == truth_data)
-  {
-    GNUNET_break (0);
-  }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Truth json before upload: %s\n",
               json_dumps (truth_data, JSON_COMPACT));
+  GNUNET_assert (NULL != truth_data);
 
-  return *truth_data;
+  return truth_data;
 }
 
+
 /**
  * Make the "truth store" command.
  *
@@ -440,7 +442,6 @@ ANASTASIS_TESTING_get_truth_example ()
  * @param http_status expected HTTP status.
  * @param tso truth store options
  * @param truth_data recovery data to post /truth
- * @param truth_data_size size of truth data
  * @return the command
  */
 struct TALER_TESTING_Command
@@ -450,8 +451,7 @@ ANASTASIS_TESTING_cmd_truth_store (const char *label,
                                    unsigned int http_status,
                                    enum
                                    ANASTASIS_TESTING_TruthStoreOption tso,
-                                   json_t *truth_data,
-                                   size_t truth_data_size)
+                                   json_t *truth_data)
 {
   struct TruthStoreState *tss;
 

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



reply via email to

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