gnunet-svn
[Top][All Lists]
Advanced

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

[taler-donau] branch master updated: [testing] work on api test


From: gnunet
Subject: [taler-donau] branch master updated: [testing] work on api test
Date: Tue, 09 Jan 2024 09:45:52 +0100

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

lukas-matyja pushed a commit to branch master
in repository donau.

The following commit(s) were added to refs/heads/master by this push:
     new 2a2240f  [testing] work on api test
2a2240f is described below

commit 2a2240f1ac8d397820d70740045da5e634a4fc2d
Author: Matyja Lukas Adam <lukas.matyja@students.bfh.ch>
AuthorDate: Tue Jan 9 09:45:09 2024 +0100

    [testing] work on api test
---
 src/testing/test_api_cmd_get_donau.c | 192 +++++++++++++++++------------------
 src/testing/test_donau_api.c         |  75 +++++++-------
 2 files changed, 132 insertions(+), 135 deletions(-)

diff --git a/src/testing/test_api_cmd_get_donau.c 
b/src/testing/test_api_cmd_get_donau.c
index d0fc638..86e337d 100644
--- a/src/testing/test_api_cmd_get_donau.c
+++ b/src/testing/test_api_cmd_get_donau.c
@@ -20,17 +20,17 @@
  * @file testing/testing_api_cmd_get_donau.c
  * @brief Command to get an donau handle
  * @author Christian Grothoff
+ * @author Lukas Matyja
  */
 #include "platform.h"
-#include "taler_json_lib.h"
+#include "taler/taler_json_lib.h"
 #include <gnunet/gnunet_curl_lib.h>
-#include "taler_testing_lib.h"
-
+#include "taler/taler_testing_lib.h"
 
 /**
  * State for a "get donau" CMD.
  */
-struct GetExchangeState
+struct GetDonauState
 {
 
   /**
@@ -39,14 +39,14 @@ struct GetExchangeState
   struct TALER_TESTING_Interpreter *is;
 
   /**
-   * Exchange handle we produced.
+   * Donau handle we produced.
    */
-  struct TALER_EXCHANGE_GetKeysHandle *donau;
+  struct DONAU_GetKeysHandle *donau;
 
   /**
    * Keys of the donau.
    */
-  struct TALER_EXCHANGE_Keys *keys;
+  struct DONAU_Keys *keys;
 
   /**
    * URL of the donau.
@@ -57,12 +57,12 @@ struct GetExchangeState
    * Label of a command to use to obtain existing
    * keys.
    */
-  const char *last_keys_ref;
+  //const char *last_keys_ref;
 
   /**
    * Last denomination date we received when doing this request.
    */
-  struct GNUNET_TIME_Timestamp my_denom_date;
+  //struct GNUNET_TIME_Timestamp my_denom_date;
 
   /**
    * Are we waiting for /keys before continuing?
@@ -80,10 +80,10 @@ struct GetExchangeState
  */
 static void
 cert_cb (void *cls,
-         const struct TALER_EXCHANGE_KeysResponse *kr,
-         struct TALER_EXCHANGE_Keys *keys)
+         const struct DONAU_KeysResponse *kr,
+         struct DONAU_Keys *keys)
 {
-  struct GetExchangeState *ges = cls;
+  struct GetDonauState *ges = cls;
   const struct TALER_EXCHANGE_HttpResponse *hr = &kr->hr;
   struct TALER_TESTING_Interpreter *is = ges->is;
 
@@ -98,7 +98,7 @@ cert_cb (void *cls,
       TALER_TESTING_interpreter_next (is);
       return;
     }
-    ges->my_denom_date = kr->details.ok.keys->last_denom_issue_date;
+    //ges->my_denom_date = kr->details.ok.keys->last_denom_issue_date;
     return;
   default:
     GNUNET_break (0);
@@ -128,8 +128,8 @@ get_donau_run (void *cls,
                   const struct TALER_TESTING_Command *cmd,
                   struct TALER_TESTING_Interpreter *is)
 {
-  struct GetExchangeState *ges = cls;
-  struct TALER_EXCHANGE_Keys *xkeys = NULL;
+  struct GetDonauState *ges = cls;
+  struct DONAU_Keys *xkeys = NULL;
 
   (void) cmd;
   if (NULL == ges->donau_url)
@@ -138,81 +138,81 @@ get_donau_run (void *cls,
     TALER_TESTING_interpreter_fail (is);
     return;
   }
-  if (NULL != ges->last_keys_ref)
-  {
-    const struct TALER_TESTING_Command *state_cmd;
-    struct TALER_EXCHANGE_Keys *old_keys;
-    const char *donau_url;
-    json_t *s_keys;
-
-    state_cmd
-      = TALER_TESTING_interpreter_lookup_command (is,
-                                                  ges->last_keys_ref);
-    if (NULL == state_cmd)
-    {
-      /* Command providing serialized keys not found.  */
-      GNUNET_break (0);
-      TALER_TESTING_interpreter_fail (is);
-      return;
-    }
-    if (GNUNET_OK !=
-        TALER_TESTING_get_trait_keys (state_cmd,
-                                      &old_keys))
-    {
-      GNUNET_break (0);
-      TALER_TESTING_interpreter_fail (is);
-      return;
-    }
-    if (NULL == old_keys)
-    {
-      GNUNET_break (0);
-      TALER_TESTING_interpreter_fail (is);
-      return;
-    }
-    if (GNUNET_OK !=
-        TALER_TESTING_get_trait_exchange_url (state_cmd,
-                                              &donau_url))
-    {
-      GNUNET_break (0);
-      TALER_TESTING_interpreter_fail (is);
-      return;
-    }
-    if (0 != strcmp (donau_url,
-                     ges->donau_url))
-    {
-      GNUNET_break (0);
-      TALER_TESTING_interpreter_fail (is);
-      return;
-    }
-    s_keys = TALER_EXCHANGE_keys_to_json (old_keys);
-    if (NULL == s_keys)
-    {
-      GNUNET_break (0);
-      TALER_TESTING_interpreter_fail (is);
-      return;
-    }
-    xkeys = TALER_EXCHANGE_keys_from_json (s_keys);
-    if (NULL == xkeys)
-    {
-      GNUNET_break (0);
-      json_dumpf (s_keys,
-                  stderr,
-                  JSON_INDENT (2));
-      json_decref (s_keys);
-      TALER_TESTING_interpreter_fail (is);
-      return;
-    }
-    json_decref (s_keys);
-  }
+  // if (NULL != ges->last_keys_ref)
+  // {
+  //   const struct TALER_TESTING_Command *state_cmd;
+  //   struct TALER_EXCHANGE_Keys *old_keys;
+  //   const char *donau_url;
+  //   json_t *s_keys;
+
+  //   state_cmd
+  //     = TALER_TESTING_interpreter_lookup_command (is,
+  //                                                 ges->last_keys_ref);
+  //   if (NULL == state_cmd)
+  //   {
+  //     /* Command providing serialized keys not found.  */
+  //     GNUNET_break (0);
+  //     TALER_TESTING_interpreter_fail (is);
+  //     return;
+  //   }
+  //   if (GNUNET_OK !=
+  //       TALER_TESTING_get_trait_keys (state_cmd,
+  //                                     &old_keys))
+  //   {
+  //     GNUNET_break (0);
+  //     TALER_TESTING_interpreter_fail (is);
+  //     return;
+  //   }
+  //   if (NULL == old_keys)
+  //   {
+  //     GNUNET_break (0);
+  //     TALER_TESTING_interpreter_fail (is);
+  //     return;
+  //   }
+  //   if (GNUNET_OK !=
+  //       TALER_TESTING_get_trait_exchange_url (state_cmd,
+  //                                             &donau_url))
+  //   {
+  //     GNUNET_break (0);
+  //     TALER_TESTING_interpreter_fail (is);
+  //     return;
+  //   }
+  //   if (0 != strcmp (donau_url,
+  //                    ges->donau_url))
+  //   {
+  //     GNUNET_break (0);
+  //     TALER_TESTING_interpreter_fail (is);
+  //     return;
+  //   }
+  //   s_keys = TALER_EXCHANGE_keys_to_json (old_keys);
+  //   if (NULL == s_keys)
+  //   {
+  //     GNUNET_break (0);
+  //     TALER_TESTING_interpreter_fail (is);
+  //     return;
+  //   }
+  //   xkeys = TALER_EXCHANGE_keys_from_json (s_keys);
+  //   if (NULL == xkeys)
+  //   {
+  //     GNUNET_break (0);
+  //     json_dumpf (s_keys,
+  //                 stderr,
+  //                 JSON_INDENT (2));
+  //     json_decref (s_keys);
+  //     TALER_TESTING_interpreter_fail (is);
+  //     return;
+  //   }
+  //   json_decref (s_keys);
+  // }
 
   ges->is = is;
   ges->donau
-    = TALER_EXCHANGE_get_keys (TALER_TESTING_interpreter_get_context (is),
+    = DONAU_get_keys (TALER_TESTING_interpreter_get_context (is),
                                ges->donau_url,
-                               xkeys,
+                               //xkeys,
                                &cert_cb,
                                ges);
-  TALER_EXCHANGE_keys_decref (xkeys);
+  //DONAU_keys_decref (xkeys);
   if (NULL == ges->donau)
   {
     GNUNET_break (0);
@@ -234,14 +234,14 @@ static void
 get_donau_cleanup (void *cls,
                       const struct TALER_TESTING_Command *cmd)
 {
-  struct GetExchangeState *ges = cls;
+  struct GetDonauState *ges = cls;
 
   if (NULL != ges->donau)
   {
-    TALER_EXCHANGE_get_keys_cancel (ges->donau);
+    DONAU_get_keys_cancel (ges->donau);
     ges->donau = NULL;
   }
-  TALER_EXCHANGE_keys_decref (ges->keys);
+  DONAU_keys_decref (ges->keys);
   ges->keys = NULL;
   GNUNET_free (ges->donau_url);
   GNUNET_free (ges);
@@ -263,7 +263,7 @@ get_donau_traits (void *cls,
                      const char *trait,
                      unsigned int index)
 {
-  struct GetExchangeState *ges = cls;
+  struct GetDonauState *ges = cls;
   //unsigned int off = (NULL == ges->master_priv_file) ? 1 : 0;
   unsigned int off = 1;
 
@@ -272,8 +272,8 @@ get_donau_traits (void *cls,
     struct TALER_TESTING_Trait traits[] = {
       TALER_TESTING_make_trait_keys (ges->keys),
       TALER_TESTING_make_trait_exchange_url (ges->donau_url),
-      TALER_TESTING_make_trait_timestamp (0,
-                                          &ges->my_denom_date),
+      //TALER_TESTING_make_trait_timestamp (0,
+      //                                    &ges->my_denom_date),
       TALER_TESTING_trait_end ()
     };
 
@@ -286,8 +286,8 @@ get_donau_traits (void *cls,
   {
     struct TALER_TESTING_Trait traits[] = {
       TALER_TESTING_make_trait_exchange_url (ges->donau_url),
-      TALER_TESTING_make_trait_timestamp (0,
-                                          &ges->my_denom_date),
+      //TALER_TESTING_make_trait_timestamp (0,
+      //                                    &ges->my_denom_date),
       TALER_TESTING_trait_end ()
     };
 
@@ -330,15 +330,15 @@ struct TALER_TESTING_Command
 TALER_TESTING_cmd_get_donau (
   const char *label,
   const struct GNUNET_CONFIGURATION_Handle *cfg,
-  const char *last_keys_ref,
+  //const char *last_keys_ref,
   bool wait_for_keys,
   bool load_private_key)
 {
-  struct GetExchangeState *ges;
+  struct GetDonauState *ges;
 
-  ges = GNUNET_new (struct GetExchangeState);
+  ges = GNUNET_new (struct GetDonauState);
   ges->donau_url = get_donau_base_url (cfg);
-  ges->last_keys_ref = last_keys_ref;
+  //ges->last_keys_ref = last_keys_ref;
   ges->wait_for_keys = wait_for_keys;
   {
     struct TALER_TESTING_Command cmd = {
diff --git a/src/testing/test_donau_api.c b/src/testing/test_donau_api.c
index 7104dd3..4d3b900 100644
--- a/src/testing/test_donau_api.c
+++ b/src/testing/test_donau_api.c
@@ -1193,46 +1193,45 @@ run (void *cls,
 #define RESERVE_OPEN_CLOSE_CHUNK 4
 #define RESERVE_OPEN_CLOSE_ITERATIONS 3
 
-  struct TALER_TESTING_Command 
reserve_open_close[(RESERVE_OPEN_CLOSE_ITERATIONS
-                                                   * RESERVE_OPEN_CLOSE_CHUNK)
-                                                  + 1];
+  // struct TALER_TESTING_Command 
reserve_open_close[(RESERVE_OPEN_CLOSE_ITERATIONS
+  //                                                  * 
RESERVE_OPEN_CLOSE_CHUNK)
+  //                                                 + 1];
 
-  (void) cls;
-  for (unsigned int i = 0;
-       i < RESERVE_OPEN_CLOSE_ITERATIONS;
-       i++)
-  {
-    reserve_open_close[(i * RESERVE_OPEN_CLOSE_CHUNK) + 0]
-      = CMD_TRANSFER_TO_EXCHANGE ("reserve-open-close-key",
-                                  "EUR:20");
-    reserve_open_close[(i * RESERVE_OPEN_CLOSE_CHUNK) + 1]
-      = TALER_TESTING_cmd_exec_wirewatch2 ("reserve-open-close-wirewatch",
-                                           config_file_expire_reserve_now,
-                                           "exchange-account-2");
-    reserve_open_close[(i * RESERVE_OPEN_CLOSE_CHUNK) + 2]
-      = TALER_TESTING_cmd_exec_closer ("reserve-open-close-aggregation",
-                                       config_file_expire_reserve_now,
-                                       "EUR:19.99",
-                                       "EUR:0.01",
-                                       "reserve-open-close-key");
-    reserve_open_close[(i * RESERVE_OPEN_CLOSE_CHUNK) + 3]
-      = TALER_TESTING_cmd_status ("reserve-open-close-status",
-                                  "reserve-open-close-key",
-                                  "EUR:0",
-                                  MHD_HTTP_OK);
-  }
-  reserve_open_close[RESERVE_OPEN_CLOSE_ITERATIONS * RESERVE_OPEN_CLOSE_CHUNK]
-    = TALER_TESTING_cmd_end ();
+  // (void) cls;
+  // for (unsigned int i = 0;
+  //      i < RESERVE_OPEN_CLOSE_ITERATIONS;
+  //      i++)
+  // {
+  //   reserve_open_close[(i * RESERVE_OPEN_CLOSE_CHUNK) + 0]
+  //     = CMD_TRANSFER_TO_EXCHANGE ("reserve-open-close-key",
+  //                                 "EUR:20");
+  //   reserve_open_close[(i * RESERVE_OPEN_CLOSE_CHUNK) + 1]
+  //     = TALER_TESTING_cmd_exec_wirewatch2 ("reserve-open-close-wirewatch",
+  //                                          config_file_expire_reserve_now,
+  //                                          "exchange-account-2");
+  //   reserve_open_close[(i * RESERVE_OPEN_CLOSE_CHUNK) + 2]
+  //     = TALER_TESTING_cmd_exec_closer ("reserve-open-close-aggregation",
+  //                                      config_file_expire_reserve_now,
+  //                                      "EUR:19.99",
+  //                                      "EUR:0.01",
+  //                                      "reserve-open-close-key");
+  //   reserve_open_close[(i * RESERVE_OPEN_CLOSE_CHUNK) + 3]
+  //     = TALER_TESTING_cmd_status ("reserve-open-close-status",
+  //                                 "reserve-open-close-key",
+  //                                 "EUR:0",
+  //                                 MHD_HTTP_OK);
+  // }
+  // reserve_open_close[RESERVE_OPEN_CLOSE_ITERATIONS * 
RESERVE_OPEN_CLOSE_CHUNK]
+  //   = TALER_TESTING_cmd_end ();
 
   {
     struct TALER_TESTING_Command commands[] = {
-      TALER_TESTING_cmd_system_start ("start-taler",
+      TALER_TESTING_cmd_system_start ("start-taler-donau",
                                       config_file,
                                       "-D",
                                       NULL),
       TALER_TESTING_cmd_get_donau ("get-donau",
                                       cred.cfg,
-                                      NULL,
                                       true,
                                       true),
       /* End the suite. */
@@ -1265,14 +1264,12 @@ main (int argc,
         //             cipher);
     GNUNET_free (cipher);
   }
-  return TALER_TESTING_main (argv,
-                             "INFO",
-                             config_file,
-                             "exchange-account-2",
-                             TALER_TESTING_BS_FAKEBANK,
-                             &cred,
-                             &run,
-                             NULL);
+  return DONAU_TESTING_main (char *const *argv,
+                    const char *loglevel,
+                    const char *cfg_file,
+                    struct TALER_TESTING_Credentials *cred,
+                    TALER_TESTING_Main main_cb,
+                    void *main_cb_cls);
 }
 
 

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