gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated: fix testing FTBFS


From: gnunet
Subject: [taler-anastasis] branch master updated: fix testing FTBFS
Date: Sat, 13 Feb 2021 13:16:20 +0100

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

grothoff pushed a commit to branch master
in repository anastasis.

The following commit(s) were added to refs/heads/master by this push:
     new 49a79aa  fix testing FTBFS
49a79aa is described below

commit 49a79aa98870feba910088d3d6d36271241c8ce1
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sat Feb 13 13:16:17 2021 +0100

    fix testing FTBFS
---
 src/include/anastasis_testing_lib.h           |  38 ++--
 src/testing/Makefile.am                       |   1 -
 src/testing/testing_api_cmd_keyshare_lookup.c |  13 +-
 src/testing/testing_cmd_challenge_answer.c    | 281 ++++++++++++++++++++++--
 src/testing/testing_cmd_challenge_start.c     | 302 --------------------------
 5 files changed, 292 insertions(+), 343 deletions(-)

diff --git a/src/include/anastasis_testing_lib.h 
b/src/include/anastasis_testing_lib.h
index f289bf3..fac4a0f 100644
--- a/src/include/anastasis_testing_lib.h
+++ b/src/include/anastasis_testing_lib.h
@@ -462,20 +462,13 @@ struct TALER_TESTING_Command
 ANASTASIS_TESTING_cmd_keyshare_lookup (
   const char *label,
   const char *anastasis_url,
-  unsigned int http_status,
   const char *answer,
   const struct ANASTASIS_CRYPTO_TruthKeyP *key,
   const char *payment_ref,
   const char *upload_ref,
-  int lookup_mode);
-
+  int lookup_mode,
+  enum ANASTASIS_KeyShareDownloadStatus ksdd);
 
-struct TALER_TESTING_Command
-ANASTASIS_TESTING_cmd_challenge_start (const char *label,
-                                       unsigned int http_status,
-                                       const char *challenge_ref,
-                                       const char *payment_ref,
-                                       unsigned int challenge_index);
 
 /**
  * Obtain a salt from @a cmd.
@@ -776,22 +769,35 @@ struct TALER_TESTING_Trait
 ANASTASIS_TESTING_make_trait_challenge (unsigned int index,
                                         const struct ANASTASIS_Challenge *r);
 
+
+struct TALER_TESTING_Command
+ANASTASIS_TESTING_cmd_challenge_start (
+  const char *label,
+  const char *payment_ref,
+  const char *challenge_ref,
+  unsigned int challenge_index,
+  enum ANASTASIS_ChallengeStatus expected_cs);
+
+
 /**
  * Make the "challenge answer" command.
  *
  * @param label command label
- * @param http_status expected HTTP status.
  * @param challenge_ref reference to the recovery process
  * @param challenge_index defines the index of the trait to solve
  * @param answer to the challenge
+ * @param expected_cs expected reply type
  * @return the command
  */
 struct TALER_TESTING_Command
-ANASTASIS_TESTING_cmd_challenge_answer (const char *label,
-                                        unsigned int http_status,
-                                        const char *challenge_ref,
-                                        unsigned int challenge_index,
-                                        const char *answer,
-                                        unsigned int mode);
+ANASTASIS_TESTING_cmd_challenge_answer (
+  const char *label,
+  const char *payment_ref,
+  const char *challenge_ref,
+  unsigned int challenge_index,
+  const char *answer,
+  unsigned int mode,
+  enum ANASTASIS_ChallengeStatus expected_cs);
+
 
 #endif
diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am
index c45a31f..6e6c2c9 100644
--- a/src/testing/Makefile.am
+++ b/src/testing/Makefile.am
@@ -31,7 +31,6 @@ libanastasistesting_la_SOURCES = \
   testing_cmd_secret_share.c \
   testing_cmd_recover_secret.c \
   testing_cmd_challenge_answer.c \
-  testing_cmd_challenge_start.c \
   testing_trait_truth.c \
   testing_trait_policy.c \
   testing_trait_core_secret.c \
diff --git a/src/testing/testing_api_cmd_keyshare_lookup.c 
b/src/testing/testing_api_cmd_keyshare_lookup.c
index a4177ed..d86e867 100644
--- a/src/testing/testing_api_cmd_keyshare_lookup.c
+++ b/src/testing/testing_api_cmd_keyshare_lookup.c
@@ -45,7 +45,7 @@ struct KeyShareLookupState
   /**
    * Expected status code.
    */
-  unsigned int http_status;
+  enum ANASTASIS_KeyShareDownloadStatus expected_ksdd;
 
   /**
    * The /truth GET operation handle.
@@ -91,17 +91,16 @@ struct KeyShareLookupState
 
 static void
 keyshare_lookup_cb (void *cls,
-                    unsigned int http_status,
                     const struct ANASTASIS_KeyShareDownloadDetails *dd)
 {
   struct KeyShareLookupState *ksls = cls;
 
   ksls->kslo = NULL;
-  if (http_status != ksls->http_status)
+  if (dd->status != ksls->expected_ksdd)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Unexpected response code %u to command %s in %s:%u\n",
-                http_status,
+                dd->status,
                 ksls->is->commands[ksls->is->ip].label,
                 __FILE__,
                 __LINE__);
@@ -265,18 +264,18 @@ struct TALER_TESTING_Command
 ANASTASIS_TESTING_cmd_keyshare_lookup (
   const char *label,
   const char *anastasis_url,
-  unsigned int http_status,
   const char *answer,
   const struct ANASTASIS_CRYPTO_TruthKeyP *key,
   const char *payment_ref,
   const char *upload_ref,
-  int lookup_mode)
+  int lookup_mode,
+  enum ANASTASIS_KeyShareDownloadStatus ksdd)
 {
   struct KeyShareLookupState *ksls;
 
   GNUNET_assert (NULL != upload_ref);
   ksls = GNUNET_new (struct KeyShareLookupState);
-  ksls->http_status = http_status;
+  ksls->expected_ksdd = ksdd;
   ksls->anastasis_url = anastasis_url;
   ksls->upload_reference = upload_ref;
   ksls->payment_reference = payment_ref;
diff --git a/src/testing/testing_cmd_challenge_answer.c 
b/src/testing/testing_cmd_challenge_answer.c
index c8872f9..135bd35 100644
--- a/src/testing/testing_cmd_challenge_answer.c
+++ b/src/testing/testing_cmd_challenge_answer.c
@@ -52,10 +52,25 @@ struct ChallengeState
    */
   const char *challenge_ref;
 
+  /**
+   * Reference to the payment
+   */
+  const char *payment_ref;
+
+  /**
+   * "taler://pay/" URL we got back, if any. Otherwise NULL.
+   */
+  char *payment_uri;
+
+  /**
+   * Payment order ID we are to provide in the request, may be NULL.
+   */
+  struct ANASTASIS_PaymentSecretP payment_order_req;
+
   /**
    * Expected status code.
    */
-  unsigned int http_status;
+  enum ANASTASIS_ChallengeStatus expected_cs;
 
   /**
    * Index of the challenge we are solving
@@ -67,21 +82,80 @@ struct ChallengeState
    */
   unsigned int mode;
 
+  /**
+   * code we read in the file generated by the plugin
+   */
+  char code[22];
+
 };
 
 
 static void
 challenge_answer_cb (void *af_cls,
-                     unsigned int http_status_code,
-                     enum TALER_ErrorCode ec)
+                     const struct ANASTASIS_ChallengeStartResponse *csr)
 {
   struct ChallengeState *cs = af_cls;
 
-  if (http_status_code != MHD_HTTP_OK)
+  if (csr->cs != cs->expected_cs)
   {
     GNUNET_break (0);
     TALER_TESTING_interpreter_fail (cs->is);
   }
+  switch (csr->cs)
+  {
+  case ANASTASIS_CHALLENGE_STATUS_SOLVED:
+    break;
+  case ANASTASIS_CHALLENGE_STATUS_INSTRUCTIONS:
+    {
+      FILE *file;
+
+      file = fopen (csr->details.open_challenge.instructions,
+                    "r");
+      if (NULL == file)
+      {
+        GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
+                                  "open",
+                                  csr->details.open_challenge.instructions);
+        TALER_TESTING_interpreter_fail (cs->is);
+        return;
+      }
+      if (0 == fscanf (file,
+                       "%21s",
+                       cs->code))
+      {
+        GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
+                                  "fscanf",
+                                  csr->details.open_challenge.instructions);
+        TALER_TESTING_interpreter_fail (cs->is);
+        fclose (file);
+        return;
+      }
+      TALER_TESTING_interpreter_next (cs->is);
+      GNUNET_break (0 == fclose (file));
+      return;
+    }
+  case ANASTASIS_CHALLENGE_STATUS_PAYMENT_REQUIRED:
+    if (0 != strncmp (csr->details.payment_required.taler_pay_uri,
+                      "taler://pay/http",
+                      strlen ("taler://pay/http")))
+    {
+      GNUNET_break (0);
+      TALER_TESTING_interpreter_fail (cs->is);
+      return;
+    }
+    cs->payment_uri = GNUNET_strdup (
+      csr->details.payment_required.taler_pay_uri);
+    TALER_TESTING_interpreter_next (cs->is);
+    return;
+  case ANASTASIS_CHALLENGE_STATUS_TRUTH_UNKNOWN:
+    break;
+  case ANASTASIS_CHALLENGE_STATUS_REDIRECT_FOR_AUTHENTICATION:
+    break;
+  case ANASTASIS_CHALLENGE_STATUS_SERVER_FAILURE:
+    GNUNET_break (0);
+    TALER_TESTING_interpreter_fail (cs->is);
+    return;
+  }
   TALER_TESTING_interpreter_next (cs->is);
 }
 
@@ -99,12 +173,14 @@ challenge_answer_run (void *cls,
                       struct TALER_TESTING_Interpreter *is)
 {
   struct ChallengeState *cs = cls;
-  const struct TALER_TESTING_Command *ref;
   const struct ANASTASIS_Challenge *c;
+  const struct ANASTASIS_PaymentSecretP *ps;
 
   cs->is = is;
   if (NULL != cs->challenge_ref)
   {
+    const struct TALER_TESTING_Command *ref;
+
     ref = TALER_TESTING_interpreter_lookup_command (
       is,
       cs->challenge_ref);
@@ -127,6 +203,7 @@ challenge_answer_run (void *cls,
   if (1 == cs->mode)
   {
     const char *code;
+    const struct TALER_TESTING_Command *ref;
 
     ref = TALER_TESTING_interpreter_lookup_command (is,
                                                     cs->answer);
@@ -147,10 +224,39 @@ challenge_answer_run (void *cls,
     }
     cs->answer = code;
   }
+
+  if (NULL != cs->payment_ref)
+  {
+    const struct TALER_TESTING_Command *ref;
+
+    ref = TALER_TESTING_interpreter_lookup_command (is,
+                                                    cs->payment_ref);
+    if (NULL == ref)
+    {
+      GNUNET_break (0);
+      TALER_TESTING_interpreter_fail (cs->is);
+      return;
+    }
+    if (GNUNET_OK !=
+        ANASTASIS_TESTING_get_trait_payment_secret (ref,
+                                                    0,
+                                                    &ps))
+    {
+      GNUNET_break (0);
+      TALER_TESTING_interpreter_fail (cs->is);
+      return;
+    }
+  }
+  else
+  {
+    ps = NULL;
+  }
+
+
   cs->c = (struct ANASTASIS_Challenge *) c;
   if (GNUNET_OK !=
       ANASTASIS_challenge_answer (cs->c,
-                                  NULL, /* FIXME: support payment */
+                                  ps,
                                   cs->answer,
                                   &challenge_answer_cb,
                                   cs))
@@ -163,6 +269,82 @@ challenge_answer_run (void *cls,
 }
 
 
+/**
+ * Run a "recover secret" CMD.
+ *
+ * @param cls closure.
+ * @param cmd command currently being run.
+ * @param is interpreter state.
+ */
+static void
+challenge_start_run (void *cls,
+                     const struct TALER_TESTING_Command *cmd,
+                     struct TALER_TESTING_Interpreter *is)
+{
+  struct ChallengeState *cs = cls;
+  const struct ANASTASIS_Challenge *c;
+  const struct TALER_TESTING_Command *ref;
+  const struct ANASTASIS_PaymentSecretP *ps;
+
+  cs->is = is;
+  ref = TALER_TESTING_interpreter_lookup_command (
+    is,
+    cs->challenge_ref);
+  if (NULL == ref)
+  {
+    GNUNET_break (0);
+    TALER_TESTING_interpreter_fail (cs->is);
+    return;
+  }
+  if (GNUNET_OK !=
+      ANASTASIS_TESTING_get_trait_challenge (ref,
+                                             cs->challenge_index,
+                                             &c))
+  {
+    GNUNET_break (0);
+    TALER_TESTING_interpreter_fail (cs->is);
+    return;
+  }
+  if (NULL != cs->payment_ref)
+  {
+    const struct TALER_TESTING_Command *ref;
+
+    ref = TALER_TESTING_interpreter_lookup_command (is,
+                                                    cs->payment_ref);
+    if (NULL == ref)
+    {
+      GNUNET_break (0);
+      TALER_TESTING_interpreter_fail (cs->is);
+      return;
+    }
+    if (GNUNET_OK !=
+        ANASTASIS_TESTING_get_trait_payment_secret (ref,
+                                                    0,
+                                                    &ps))
+    {
+      GNUNET_break (0);
+      TALER_TESTING_interpreter_fail (cs->is);
+      return;
+    }
+  }
+  else
+  {
+    ps = NULL;
+  }
+  if (GNUNET_OK !=
+      ANASTASIS_challenge_start ((struct ANASTASIS_Challenge *) c,
+                                 ps,
+                                 NULL,
+                                 &challenge_answer_cb,
+                                 cs))
+  {
+    GNUNET_break (0);
+    TALER_TESTING_interpreter_fail (cs->is);
+    return;
+  }
+}
+
+
 /**
  * Free the state of a "recover secret" CMD, and possibly
  * cancel it if it did not complete.
@@ -171,8 +353,8 @@ challenge_answer_run (void *cls,
  * @param cmd command being freed.
  */
 static void
-challenge_answer_cleanup (void *cls,
-                          const struct TALER_TESTING_Command *cmd)
+challenge_cleanup (void *cls,
+                   const struct TALER_TESTING_Command *cmd)
 {
   struct ChallengeState *cs = cls;
 
@@ -181,25 +363,89 @@ challenge_answer_cleanup (void *cls,
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                 "Command '%s' did not complete (challenge answer)\n",
                 cmd->label);
-    ANASTASIS_challenge_answer_cancel (cs->c);
+    ANASTASIS_challenge_abort (cs->c);
     cs->c = NULL;
   }
   GNUNET_free (cs);
 }
 
 
+/**
+ * Offer internal data to other commands.
+ *
+ * @param cls closure
+ * @param ret[out] result (could be anything)
+ * @param trait name of the trait
+ * @param index index number of the object to extract.
+ * @return #GNUNET_OK on success
+ */
+static int
+challenge_create_traits (void *cls,
+                         const void **ret,
+                         const char *trait,
+                         unsigned int index)
+{
+  struct ChallengeState *cs = cls;
+  struct TALER_TESTING_Trait traits[] = {
+    ANASTASIS_TESTING_make_trait_code (0,
+                                       cs->code),
+    ANASTASIS_TESTING_make_trait_payment_secret (0,
+                                                 &cs->payment_order_req),
+    TALER_TESTING_make_trait_url (TALER_TESTING_UT_TALER_URL,
+                                  cs->payment_uri),
+    TALER_TESTING_trait_end ()
+  };
+
+  return TALER_TESTING_get_trait (traits,
+                                  ret,
+                                  trait,
+                                  index);
+}
+
+
+struct TALER_TESTING_Command
+ANASTASIS_TESTING_cmd_challenge_start (
+  const char *label,
+  const char *payment_ref,
+  const char *challenge_ref,
+  unsigned int challenge_index,
+  enum ANASTASIS_ChallengeStatus expected_cs)
+{
+  struct ChallengeState *cs;
+
+  cs = GNUNET_new (struct ChallengeState);
+  cs->expected_cs = expected_cs;
+  cs->challenge_ref = challenge_ref;
+  cs->payment_ref = payment_ref;
+  cs->challenge_index = challenge_index;
+  {
+    struct TALER_TESTING_Command cmd = {
+      .cls = cs,
+      .label = label,
+      .run = &challenge_start_run,
+      .cleanup = &challenge_cleanup,
+      .traits = &challenge_create_traits
+    };
+
+    return cmd;
+  }
+}
+
+
 struct TALER_TESTING_Command
-ANASTASIS_TESTING_cmd_challenge_answer (const char *label,
-                                        unsigned int http_status,
-                                        const char *challenge_ref,
-                                        unsigned int challenge_index,
-                                        const char *answer,
-                                        unsigned int mode)
+ANASTASIS_TESTING_cmd_challenge_answer (
+  const char *label,
+  const char *payment_ref,
+  const char *challenge_ref,
+  unsigned int challenge_index,
+  const char *answer,
+  unsigned int mode,
+  enum ANASTASIS_ChallengeStatus expected_cs)
 {
   struct ChallengeState *cs;
 
   cs = GNUNET_new (struct ChallengeState);
-  cs->http_status = http_status;
+  cs->expected_cs = expected_cs;
   cs->challenge_ref = challenge_ref;
   cs->answer = answer;
   cs->challenge_index = challenge_index;
@@ -209,7 +455,8 @@ ANASTASIS_TESTING_cmd_challenge_answer (const char *label,
       .cls = cs,
       .label = label,
       .run = &challenge_answer_run,
-      .cleanup = &challenge_answer_cleanup,
+      .cleanup = &challenge_cleanup,
+      .traits = &challenge_create_traits
     };
 
     return cmd;
diff --git a/src/testing/testing_cmd_challenge_start.c 
b/src/testing/testing_cmd_challenge_start.c
deleted file mode 100644
index cc3fa33..0000000
--- a/src/testing/testing_cmd_challenge_start.c
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
-  This file is part of Anastasis
-  Copyright (C) 2020, 2021 Taler Systems SA
-
-  Anastasis is free software; you can redistribute it and/or modify it under 
the
-  terms of the GNU Lesser General Public License as published by the Free 
Software
-  Foundation; either version 3, or (at your option) any later version.
-
-  Anastasis is distributed in the hope that it will be useful, but WITHOUT ANY
-  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-  A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License along with
-  Anastasis; see the file COPYING.GPL.  If not, see 
<http://www.gnu.org/licenses/>
-*/
-/**
- * @file lib/testing_cmd_challenge_start.c
- * @brief command to execute the anastasis recovery service
- * @author Christian Grothoff
- * @author Dennis Neufeld
- * @author Dominik Meister
- */
-
-#include "platform.h"
-#include "anastasis_testing_lib.h"
-#include <taler/taler_util.h>
-#include <taler/taler_testing_lib.h>
-
-
-/**
- * State for a "challenge answer" CMD.
- */
-struct ChallengeState
-{
-
-  /**
-   * The interpreter state.
-   */
-  struct TALER_TESTING_Interpreter *is;
-
-  /**
-   * Answer to the challenge we are solving
-   */
-  const char *answer;
-
-  /**
-   * Reference to the recovery process
-   */
-  const char *challenge_ref;
-
-  /**
-   * Index of the challenge we are solving
-   */
-  unsigned int challenge_index;
-
-  /**
-   * Reference to the payment
-   */
-  const char *payment_ref;
-
-  /**
-   * "taler://pay/" URL we got back, if any. Otherwise NULL.
-   */
-  char *payment_uri;
-
-  /**
-   * Payment order ID we are to provide in the request, may be NULL.
-   */
-  struct ANASTASIS_PaymentSecretP payment_order_req;
-
-  /**
-   * Expected status code.
-   */
-  unsigned int http_status;
-
-  /**
-   * code we read in the file generated by the plugin
-   */
-  char code[22];
-};
-
-
-/**
- * Callback for the response status for a challenge start operation.
- *
- * @param cls handle to the request
- * @param csr response details
- */
-static void
-challenge_start_cb (void *cls,
-                    const struct ANASTASIS_ChallengeStartResponse *csr)
-{
-  struct ChallengeState *cs = cls;
-  FILE *file;
-
-  switch (csr->cs)
-  {
-  case ANASTASIS_CHALLENGE_STATUS_INSTRUCTIONS:
-    file = fopen (csr->details.instructions,
-                  "r");
-    if (NULL == file)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "Could not find file: %s to command %s in %s:%u\n",
-                  csr->details.instructions,
-                  cs->is->commands[cs->is->ip].label,
-                  __FILE__,
-                  __LINE__);
-      TALER_TESTING_interpreter_fail (cs->is);
-      return;
-    }
-    if (0 == fscanf (file, "%21s", cs->code))
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "could not read file: %s to command %s in %s:%u\n",
-                  csr->details.instructions,
-                  cs->is->commands[cs->is->ip].label,
-                  __FILE__,
-                  __LINE__);
-      TALER_TESTING_interpreter_fail (cs->is);
-      fclose (file);
-      return;
-    }
-    TALER_TESTING_interpreter_next (cs->is);
-    fclose (file);
-    return;
-  case ANASTASIS_CHALLENGE_STATUS_PAYMENT_REQUIRED:
-    if (0 != strncmp (csr->details.payment_required.taler_pay_url,
-                      "taler://pay/http",
-                      strlen ("taler://pay/http")))
-    {
-      GNUNET_break (0);
-      TALER_TESTING_interpreter_fail (cs->is);
-      return;
-    }
-    cs->payment_uri = GNUNET_strdup (
-      csr->details.payment_required.taler_pay_url);
-    TALER_TESTING_interpreter_next (cs->is);
-    return;
-  case ANASTASIS_CHALLENGE_STATUS_SERVER_FAILURE:
-    GNUNET_break (0);
-    TALER_TESTING_interpreter_fail (cs->is);
-    return;
-  }
-}
-
-
-/**
- * Offer internal data to other commands.
- *
- * @param cls closure
- * @param ret[out] result (could be anything)
- * @param trait name of the trait
- * @param index index number of the object to extract.
- * @return #GNUNET_OK on success
- */
-static int
-challenge_start_create_traits (void *cls,
-                               const void **ret,
-                               const char *trait,
-                               unsigned int index)
-{
-  struct ChallengeState *cs = cls;
-  struct TALER_TESTING_Trait traits[] = {
-    ANASTASIS_TESTING_make_trait_code (0,
-                                       cs->code),
-    ANASTASIS_TESTING_make_trait_payment_secret (0,
-                                                 &cs->payment_order_req),
-    TALER_TESTING_make_trait_url (TALER_TESTING_UT_TALER_URL,
-                                  cs->payment_uri),
-    TALER_TESTING_trait_end ()
-  };
-
-  return TALER_TESTING_get_trait (traits,
-                                  ret,
-                                  trait,
-                                  index);
-}
-
-
-/**
- * Run a "recover secret" CMD.
- *
- * @param cls closure.
- * @param cmd command currently being run.
- * @param is interpreter state.
- */
-static void
-challenge_start_run (void *cls,
-                     const struct TALER_TESTING_Command *cmd,
-                     struct TALER_TESTING_Interpreter *is)
-{
-  struct ChallengeState *cs = cls;
-  const struct ANASTASIS_Challenge *c;
-  const struct TALER_TESTING_Command *ref;
-  const struct ANASTASIS_PaymentSecretP *ps;
-
-  cs->is = is;
-  ref = TALER_TESTING_interpreter_lookup_command (
-    is,
-    cs->challenge_ref);
-  if (NULL == ref)
-  {
-    GNUNET_break (0);
-    TALER_TESTING_interpreter_fail (cs->is);
-    return;
-  }
-  if (GNUNET_OK !=
-      ANASTASIS_TESTING_get_trait_challenge (ref,
-                                             cs->challenge_index,
-                                             &c))
-  {
-    GNUNET_break (0);
-    TALER_TESTING_interpreter_fail (cs->is);
-    return;
-  }
-  if (NULL != cs->payment_ref)
-  {
-    const struct TALER_TESTING_Command *ref;
-
-    ref = TALER_TESTING_interpreter_lookup_command (is,
-                                                    cs->payment_ref);
-    if (NULL == ref)
-    {
-      GNUNET_break (0);
-      TALER_TESTING_interpreter_fail (cs->is);
-      return;
-    }
-    if (GNUNET_OK !=
-        ANASTASIS_TESTING_get_trait_payment_secret (ref,
-                                                    0,
-                                                    &ps))
-    {
-      GNUNET_break (0);
-      TALER_TESTING_interpreter_fail (cs->is);
-      return;
-    }
-  }
-  else
-  {
-    ps = NULL;
-  }
-  if (GNUNET_OK !=
-      ANASTASIS_challenge_start ((struct ANASTASIS_Challenge *) c,
-                                 ps,
-                                 &challenge_start_cb,
-                                 cs))
-  {
-    GNUNET_break (0);
-    TALER_TESTING_interpreter_fail (cs->is);
-    return;
-  }
-}
-
-
-/**
- * Free the state of a "recover secret" CMD, and possibly
- * cancel it if it did not complete.
- *
- * @param cls closure.
- * @param cmd command being freed.
- */
-static void
-challenge_start_cleanup (void *cls,
-                         const struct TALER_TESTING_Command *cmd)
-{
-  struct ChallengeState *cs = cls;
-
-  GNUNET_free (cs->payment_uri);
-  GNUNET_free (cs);
-}
-
-
-struct TALER_TESTING_Command
-ANASTASIS_TESTING_cmd_challenge_start (const char *label,
-                                       unsigned int http_status,
-                                       const char *challenge_ref,
-                                       const char *payment_ref,
-                                       unsigned int challenge_index)
-{
-  struct ChallengeState *cs;
-
-  cs = GNUNET_new (struct ChallengeState);
-  cs->http_status = http_status;
-  cs->challenge_ref = challenge_ref;
-  cs->payment_ref = payment_ref;
-  cs->challenge_index = challenge_index;
-  {
-    struct TALER_TESTING_Command cmd = {
-      .cls = cs,
-      .label = label,
-      .run = &challenge_start_run,
-      .cleanup = &challenge_start_cleanup,
-      .traits = &challenge_start_create_traits
-    };
-
-    return cmd;
-  }
-}
-
-
-/* end of testing_cmd_challenge_answer.c */

-- 
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]