gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated: get test_anastasis to build


From: gnunet
Subject: [taler-anastasis] branch master updated: get test_anastasis to build
Date: Sun, 14 Feb 2021 14:48:27 +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 938871a  get test_anastasis to build
938871a is described below

commit 938871a1457cd5be296bd6f0a5a61409786ebb13
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Feb 14 14:48:25 2021 +0100

    get test_anastasis to build
---
 src/include/anastasis_testing_lib.h |  52 +++++++----
 src/testing/test_anastasis.c        | 168 +++++++++++++++---------------------
 2 files changed, 104 insertions(+), 116 deletions(-)

diff --git a/src/include/anastasis_testing_lib.h 
b/src/include/anastasis_testing_lib.h
index d24aa15..adf8323 100644
--- a/src/include/anastasis_testing_lib.h
+++ b/src/include/anastasis_testing_lib.h
@@ -711,16 +711,17 @@ enum ANASTASIS_TESTING_SecretShareOption
  * @return the command
  */
 struct TALER_TESTING_Command
-ANASTASIS_TESTING_cmd_secret_share (const char *label,
-                                    const char *anastasis_url,
-                                    const char *prev_secret_share,
-                                    const json_t *id_data,
-                                    const void *core_secret,
-                                    size_t core_secret_size,
-                                    unsigned int http_status,
-                                    enum
-                                    ANASTASIS_TESTING_SecretShareOption sso,
-                                    ...);
+ANASTASIS_TESTING_cmd_secret_share (
+  const char *label,
+  const char *anastasis_url,
+  const char *prev_secret_share,
+  const json_t *id_data,
+  const void *core_secret,
+  size_t core_secret_size,
+  unsigned int http_status,
+  enum ANASTASIS_TESTING_SecretShareOption sso,
+  ...);
+
 
 /* ********************* test recover secret ********************* */
 
@@ -746,6 +747,7 @@ enum ANASTASIS_TESTING_RecoverSecretOption
 
 };
 
+
 /**
  * Make the "recover secret" command.
  *
@@ -759,15 +761,15 @@ enum ANASTASIS_TESTING_RecoverSecretOption
  * @return the command
  */
 struct TALER_TESTING_Command
-ANASTASIS_TESTING_cmd_recover_secret (const char *label,
-                                      const char *anastasis_url,
-                                      json_t *id_data,
-                                      unsigned int version,
-                                      unsigned int http_status,
-                                      enum 
ANASTASIS_TESTING_RecoverSecretOption
-                                      rso,
-                                      const char *download_ref,
-                                      const char *core_secret_ref);
+ANASTASIS_TESTING_cmd_recover_secret (
+  const char *label,
+  const char *anastasis_url,
+  json_t *id_data,
+  unsigned int version,
+  unsigned int http_status,
+  enum ANASTASIS_TESTING_RecoverSecretOption rso,
+  const char *download_ref,
+  const char *core_secret_ref);
 
 
 /* ********************* test challenge answer ********************* */
@@ -796,6 +798,17 @@ ANASTASIS_TESTING_make_trait_challenge (unsigned int index,
                                         const struct ANASTASIS_Challenge *r);
 
 
+/**
+ * Create a "challenge start" command. Suitable for the "file"
+ * authorization plugin.
+ *
+ * @param label command label
+ * @param payment_ref reference to payment made for this challenge
+ * @param challenge_ref reference to the recovery process
+ * @param challenge_index defines the index of the trait to solve
+ * @param expected_cs expected reply type
+ * @return the command
+ */
 struct TALER_TESTING_Command
 ANASTASIS_TESTING_cmd_challenge_start (
   const char *label,
@@ -809,6 +822,7 @@ ANASTASIS_TESTING_cmd_challenge_start (
  * Make the "challenge answer" command.
  *
  * @param label command label
+ * @param payment_ref reference to payment made for this challenge
  * @param challenge_ref reference to the recovery process
  * @param challenge_index defines the index of the trait to solve
  * @param answer to the challenge
diff --git a/src/testing/test_anastasis.c b/src/testing/test_anastasis.c
index f868977..12eed29 100644
--- a/src/testing/test_anastasis.c
+++ b/src/testing/test_anastasis.c
@@ -1,6 +1,6 @@
 /*
   This file is part of Anastasis
-  Copyright (C) 2020 Taler Systems SA
+  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
@@ -86,6 +86,11 @@ static char *merchant_url;
  */
 static char *anastasis_url;
 
+/**
+ * Name of the file for exchanging the secret.
+ */
+static char *file_secret;
+
 /**
  * Merchant process.
  */
@@ -151,17 +156,14 @@ run (void *cls,
      * transfer.
      */
     cmd_exec_wirewatch ("wirewatch-1"),
-    TALER_TESTING_cmd_withdraw_amount
-      ("withdraw-coin-1",
-      "create-reserve-1",
-      "EUR:5",
-      MHD_HTTP_OK),
-    TALER_TESTING_cmd_withdraw_amount
-      ("withdraw-coin-2",
-      "create-reserve-1",
-      "EUR:5",
-      MHD_HTTP_OK),
-
+    TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-1",
+                                       "create-reserve-1",
+                                       "EUR:5",
+                                       MHD_HTTP_OK),
+    TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-2",
+                                       "create-reserve-1",
+                                       "EUR:5",
+                                       MHD_HTTP_OK),
     /**
      * Check the reserve is depleted.
      */
@@ -169,7 +171,6 @@ run (void *cls,
                               "create-reserve-1",
                               "EUR:0",
                               MHD_HTTP_OK),
-
     TALER_TESTING_cmd_end ()
   };
 
@@ -177,53 +178,36 @@ run (void *cls,
     ANASTASIS_TESTING_cmd_salt ("salt-request-1",
                                 anastasis_url,
                                 MHD_HTTP_OK),
-    ANASTASIS_TESTING_cmd_truth_upload ("truth-create-1",
-                                        anastasis_url,
-                                        ANASTASIS_TESTING_make_id_data_example 
(
-                                          "MaxMuster123456789"),
-                                        "question",
-                                        "You have to answer the secure 
question.",
-                                        "text/plain",
-                                        "SomeTruth1",
-                                        strlen ("SomeTruth1"),
-                                        NULL,
-                                        MHD_HTTP_NO_CONTENT,
-                                        ANASTASIS_TESTING_TSO_NONE,
-                                        "salt-request-1"),
-    ANASTASIS_TESTING_cmd_salt ("salt-request-2",
-                                anastasis_url,
-                                MHD_HTTP_OK),
-    ANASTASIS_TESTING_cmd_truth_upload ("truth-create-2",
-                                        anastasis_url,
-                                        ANASTASIS_TESTING_make_id_data_example 
(
-                                          "MaxMuster123456789"),
-                                        "question",
-                                        "You have to answer the secure 
question.",
-                                        "string",
-                                        "SomeTruth2",
-                                        strlen ("SomeTruth2"),
-                                        NULL,
-                                        MHD_HTTP_NO_CONTENT,
-                                        ANASTASIS_TESTING_TSO_NONE,
-                                        "salt-request-2"),
-    ANASTASIS_TESTING_cmd_salt ("salt-request-3",
-                                anastasis_url,
-                                MHD_HTTP_OK),
-    ANASTASIS_TESTING_cmd_truth_upload ("truth-create-3",
-                                        anastasis_url,
-                                        ANASTASIS_TESTING_make_id_data_example 
(
-                                          "MaxMuster123456789"),
-                                        "file",
-                                        "TESTING FILE PLUGIN INTEGRATION",
-                                        "string",
-                                        "SomeTruth3",
-                                        strlen ("SomeTruth3"),
-                                        NULL,
-                                        MHD_HTTP_NO_CONTENT,
-                                        ANASTASIS_TESTING_TSO_NONE,
-                                        "salt-request-3"),
+    ANASTASIS_TESTING_cmd_truth_question ("truth-create-1",
+                                          anastasis_url,
+                                          NULL,
+                                          "SomeTruth1",
+                                          ANASTASIS_TESTING_TSO_NONE,
+                                          MHD_HTTP_NO_CONTENT),
+    ANASTASIS_TESTING_cmd_truth_question ("truth-create-2",
+                                          anastasis_url,
+                                          NULL,
+                                          "SomeTruth2",
+                                          ANASTASIS_TESTING_TSO_NONE,
+                                          MHD_HTTP_NO_CONTENT),
+    ANASTASIS_TESTING_cmd_truth_store ("truth-create-3",
+                                       anastasis_url,
+                                       NULL,
+                                       "file",
+                                       "text/plain",
+                                       strlen (file_secret),
+                                       file_secret,
+                                       ANASTASIS_TESTING_TSO_NONE,
+                                       MHD_HTTP_NO_CONTENT),
     ANASTASIS_TESTING_cmd_policy_create ("policy-create-1",
                                          "truth-create-1",
+                                         "truth-create-2",
+                                         NULL),
+    ANASTASIS_TESTING_cmd_policy_create ("policy-create-2",
+                                         "truth-create-1",
+                                         "truth-create-3",
+                                         NULL),
+    ANASTASIS_TESTING_cmd_policy_create ("policy-create-3",
                                          "truth-create-2",
                                          "truth-create-3",
                                          NULL),
@@ -237,8 +221,9 @@ run (void *cls,
                                         MHD_HTTP_PAYMENT_REQUIRED,
                                         ANASTASIS_TESTING_SSO_NONE,
                                         "policy-create-1",
+                                        "policy-create-2",
+                                        "policy-create-3",
                                         NULL),
-
     /* what would we have to pay? */
     TALER_TESTING_cmd_merchant_claim_order ("fetch-proposal",
                                             merchant_url,
@@ -264,59 +249,34 @@ run (void *cls,
                                         MHD_HTTP_NO_CONTENT,
                                         ANASTASIS_TESTING_SSO_NONE,
                                         "policy-create-1",
+                                        "policy-create-2",
+                                        "policy-create-3",
                                         NULL),
     ANASTASIS_TESTING_cmd_recover_secret ("recover-secret-1",
                                           anastasis_url,
                                           
ANASTASIS_TESTING_make_id_data_example (
                                             "MaxMuster123456789"),
                                           0,
-                                          MHD_HTTP_PAYMENT_REQUIRED,
+                                          MHD_HTTP_PAYMENT_REQUIRED, // FIXME! 
WHY!?
                                           ANASTASIS_TESTING_RSO_NONE,
                                           "salt-request-1",
                                           "secret-share-2"),
-
     ANASTASIS_TESTING_cmd_challenge_answer ("challenge-answer-1",
-                                            MHD_HTTP_OK,
-                                            "recover-secret-1",
-                                            0,
+                                            NULL, /* payment ref */
+                                            "recover-secret-1", /* challenge 
ref */
+                                            0, /* challenge index */
                                             "SomeTruth1",
-                                            0),
+                                            0,  /* mode */
+                                            ANASTASIS_CHALLENGE_STATUS_SOLVED),
     ANASTASIS_TESTING_cmd_challenge_answer ("challenge-answer-2",
-                                            MHD_HTTP_OK,
+                                            NULL, /* payment ref */
                                             "recover-secret-1",
-                                            1,
+                                            1, /* challenge index */
                                             "SomeTruth2",
-                                            0),
+                                            0, /* mode */
+                                            ANASTASIS_CHALLENGE_STATUS_SOLVED),
+    // FIXME: need some 'recover_secret_conclude' command here!
 
-    ANASTASIS_TESTING_cmd_challenge_start ("challenge-start-1",
-                                           MHD_HTTP_PAYMENT_REQUIRED,
-                                           "recover-secret-1",
-                                           2),
-    /* what would we have to pay? */
-    TALER_TESTING_cmd_merchant_claim_order ("fetch-proposal",
-                                            merchant_url,
-                                            MHD_HTTP_OK,
-                                            "challenge-start-1",
-                                            NULL),
-    /* make the payment */
-    TALER_TESTING_cmd_merchant_pay_order ("pay-challenge",
-                                          merchant_url,
-                                          MHD_HTTP_OK,
-                                          "fetch-proposal",
-                                          "withdraw-coin-2",
-                                          "EUR:1.01",
-                                          "EUR:1", /* must match ANNUAL_FEE in 
config! */
-                                          NULL),
-    ANASTASIS_TESTING_cmd_challenge_start ("challenge-start-2",
-                                           MHD_HTTP_OK,
-                                           "recover-secret-1",
-                                           2),
-    ANASTASIS_TESTING_cmd_challenge_answer ("challenge-answer-3",
-                                            MHD_HTTP_OK,
-                                            "recover-secret-1",
-                                            2,
-                                            "challenge-start-2",
-                                            1),
     TALER_TESTING_cmd_end ()
   };
 
@@ -380,6 +340,20 @@ main (int argc,
                                       "exchange-account-exchange",
                                       &bc))
     return 77;
+  {
+    char dir[] = "/tmp/test-anastasis-file-XXXXXX";
+
+    if (NULL == mkdtemp (dir))
+    {
+      GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
+                                "mkdtemp",
+                                dir);
+      return 77;
+    }
+    GNUNET_asprintf (&file_secret,
+                     "%s/.secret",
+                     dir);
+  }
   payer_payto = ("payto://x-taler-bank/localhost/" USER_ACCOUNT_NAME);
   exchange_payto = ("payto://x-taler-bank/localhost/" EXCHANGE_ACCOUNT_NAME);
   merchant_payto = ("payto://x-taler-bank/localhost/" MERCHANT_ACCOUNT_NAME);

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