gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: -implement first draft of testin


From: gnunet
Subject: [taler-exchange] branch master updated: -implement first draft of testing_api_cmd_reserve_attest.c
Date: Sat, 01 Oct 2022 16:30:24 +0200

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

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 9cba7d4c -implement first draft of testing_api_cmd_reserve_attest.c
9cba7d4c is described below

commit 9cba7d4c3e03bb648d81f516faeab8d0782728c8
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sat Oct 1 16:30:22 2022 +0200

    -implement first draft of testing_api_cmd_reserve_attest.c
---
 src/testing/Makefile.am                      |  1 +
 src/testing/testing_api_cmd_reserve_attest.c | 45 +++++++++++++++++++++-------
 2 files changed, 36 insertions(+), 10 deletions(-)

diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am
index 82c786c3..256276ce 100644
--- a/src/testing/Makefile.am
+++ b/src/testing/Makefile.am
@@ -85,6 +85,7 @@ libtalertesting_la_SOURCES = \
   testing_api_cmd_recoup_refresh.c \
   testing_api_cmd_refund.c \
   testing_api_cmd_refresh.c \
+  testing_api_cmd_reserve_attest.c \
   testing_api_cmd_reserve_get.c \
   testing_api_cmd_reserve_get_attestable.c \
   testing_api_cmd_reserve_history.c \
diff --git a/src/testing/testing_api_cmd_reserve_attest.c 
b/src/testing/testing_api_cmd_reserve_attest.c
index 8ed95924..5ed25c13 100644
--- a/src/testing/testing_api_cmd_reserve_attest.c
+++ b/src/testing/testing_api_cmd_reserve_attest.c
@@ -26,7 +26,6 @@
 #include <gnunet/gnunet_curl_lib.h>
 #include "taler_testing_lib.h"
 
-
 /**
  * State for a "attest" CMD.
  */
@@ -43,11 +42,6 @@ struct AttestState
    */
   struct TALER_EXCHANGE_ReservesAttestHandle *rsh;
 
-  /**
-   * Expected reserve balance.
-   */
-  const char *expected_balance;
-
   /**
    * Private key of the reserve being analyzed.
    */
@@ -58,6 +52,16 @@ struct AttestState
    */
   struct TALER_ReservePublicKeyP reserve_pub;
 
+  /**
+   * Array of attributes to request, of length @e attrs_len.
+   */
+  const char **attrs;
+
+  /**
+   * Length of the @e attrs array.
+   */
+  unsigned int attrs_len;
+
   /**
    * Expected HTTP response code.
    */
@@ -78,12 +82,12 @@ struct AttestState
  * @param rs HTTP response details
  */
 static void
-reserve_attest_cb (void *cls,
-                   const struct TALER_EXCHANGE_ReserveAttest *rs)
+reserve_attest_cb (
+  void *cls,
+  const struct TALER_EXCHANGE_ReservePostAttestResult *rs)
 {
   struct AttestState *ss = cls;
   struct TALER_TESTING_Interpreter *is = ss->is;
-  struct TALER_Amount eb;
 
   ss->rsh = NULL;
   if (ss->expected_response_code != rs->hr.http_status)
@@ -104,6 +108,7 @@ reserve_attest_cb (void *cls,
     TALER_TESTING_interpreter_next (is);
     return;
   }
+  /* FIXME: persist attestation... */
   TALER_TESTING_interpreter_next (is);
 }
 
@@ -147,6 +152,8 @@ attest_run (void *cls,
                                       &ss->reserve_pub.eddsa_pub);
   ss->rsh = TALER_EXCHANGE_reserves_attest (is->exchange,
                                             ss->reserve_priv,
+                                            ss->attrs_len,
+                                            ss->attrs,
                                             &reserve_attest_cb,
                                             ss);
 }
@@ -174,6 +181,7 @@ attest_cleanup (void *cls,
     TALER_EXCHANGE_reserves_attest_cancel (ss->rsh);
     ss->rsh = NULL;
   }
+  GNUNET_free (ss->attrs);
   GNUNET_free (ss);
 }
 
@@ -185,12 +193,29 @@ TALER_TESTING_cmd_reserve_attest (const char *label,
                                   ...)
 {
   struct AttestState *ss;
+  unsigned int num_args;
+  const char *ea;
+  va_list ap;
+
+  num_args = 0;
+  va_start (ap, expected_response_code);
+  while (NULL != va_arg (ap, const char *))
+    num_args++;
+  va_end (ap);
 
   GNUNET_assert (NULL != reserve_reference);
   ss = GNUNET_new (struct AttestState);
   ss->reserve_reference = reserve_reference;
-  ss->expected_balance = expected_balance;
   ss->expected_response_code = expected_response_code;
+  ss->attrs_len = num_args;
+  ss->attrs = GNUNET_new_array (num_args,
+                                const char *);
+  num_args = 0;
+  va_start (ap, expected_response_code);
+  while (NULL != (ea = va_arg (ap, const char *)))
+    ss->attrs[num_args++] = ea;
+  va_end (ap);
+
   {
     struct TALER_TESTING_Command cmd = {
       .cls = ss,

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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