gnunet-svn
[Top][All Lists]
Advanced

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

[taler-donau] branch master updated (61b3045 -> 3a038f2)


From: gnunet
Subject: [taler-donau] branch master updated (61b3045 -> 3a038f2)
Date: Tue, 12 Mar 2024 09:17:43 +0100

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

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

    from 61b3045  Merge branch 'master' of ssh://git.taler.net/donau
     new 3fbd9fa  [testing] use charity id trait
     new ec58ff7  [testing] load and use BASE_URL from config file
     new 3a038f2  Merge remote-tracking branch 'refs/remotes/origin/master'

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/include/donau_testing_lib.h              |  7 +--
 src/testing/test_donau_api.c                 | 24 +++-----
 src/testing/testing_api_cmd_charities_get.c  |  2 +-
 src/testing/testing_api_cmd_charity_delete.c | 34 +++++++++--
 src/testing/testing_api_cmd_charity_get.c    |  4 +-
 src/testing/testing_api_cmd_charity_post.c   |  2 +-
 src/testing/testing_api_cmd_get_donau.c      | 88 ++++++++++++----------------
 src/testing/testing_api_loop.c               | 29 ++++++---
 8 files changed, 98 insertions(+), 92 deletions(-)

diff --git a/src/include/donau_testing_lib.h b/src/include/donau_testing_lib.h
index f9cbb76..41d386e 100644
--- a/src/include/donau_testing_lib.h
+++ b/src/include/donau_testing_lib.h
@@ -47,9 +47,7 @@ struct TALER_TESTING_Command
 TALER_TESTING_cmd_get_donau (
   const char *label,
   const struct GNUNET_CONFIGURATION_Handle *cfg,
-  // const char *last_keys_ref,
-  bool wait_for_keys,
-  bool load_private_key);
+  bool wait_for_keys);
 
 /**
  * Create a GET "charity" command.
@@ -62,7 +60,6 @@ TALER_TESTING_cmd_get_donau (
  */
 struct TALER_TESTING_Command
 TALER_TESTING_cmd_charity_get (const char *label,
-                               const uint64_t charity_id,
                                const char *charity_reference,
                                const struct DONAU_BearerToken *bearer,
                                unsigned int expected_response_code);
@@ -88,7 +85,7 @@ TALER_TESTING_cmd_charity_post (const char *label,
 
 struct TALER_TESTING_Command
 TALER_TESTING_cmd_charity_delete (const char *label,
-                                  const uint64_t charity_id,
+                                  const char *charity_reference,
                                   const struct DONAU_BearerToken *bearer,
                                   unsigned int expected_response_code);
 
diff --git a/src/testing/test_donau_api.c b/src/testing/test_donau_api.c
index 016862c..76aace5 100644
--- a/src/testing/test_donau_api.c
+++ b/src/testing/test_donau_api.c
@@ -67,24 +67,15 @@ run (void *cls,
        const struct DONAU_BearerToken bearer = {
                        .token = NULL
        };
-//     struct DONAU_CharityRequest charity_req = {
-//       .charity_pub = 
{{"EBETNXT9ZF606FRF3WD5N6G2XVD5QHDP2PTQD4GSX4VEN2YYG2C0"}},
-//       .name = "example",
-//       .charity_url = "example.com",
-//       .max_per_year = {"EUR:10"},
-//       .receipts_to_date = {"EUR:0"},
-//       .current_year = 2024
-//     };
   {
     struct TALER_TESTING_Command commands[] = {
       TALER_TESTING_cmd_system_start ("start-donau",
                                       config_file,
                                       "-D",
                                       NULL),
-//      TALER_TESTING_cmd_get_donau ("get-donau",
-//                                      cred.cfg,
-//                                      true,
-//                                      true),
+      TALER_TESTING_cmd_get_donau ("get-donau",
+                                      cred.cfg,
+                                      true),
          TALER_TESTING_cmd_charity_post ("post-charity",
                                                                          
"example",
                                                                          
"example.com",
@@ -94,17 +85,16 @@ run (void *cls,
                                                                          
&bearer,
                                                                          
MHD_HTTP_CREATED),
       TALER_TESTING_cmd_charity_get ("get-charity-by-id",
-                                                                 8,
                                                                          
"post-charity", // cmd trait reference
                                                                          
&bearer,
                                       MHD_HTTP_OK),
          TALER_TESTING_cmd_charities_get ("get-charities",
                                                                          
&bearer,
                                                                          
MHD_HTTP_OK),
-//       TALER_TESTING_cmd_charity_delete("delete-charity",
-//                                                                       
"post-charity", // cmd trait reference
-//                                                                       
&bearer,
-//                                                                       
MHD_HTTP_NO_CONTENT),
+         TALER_TESTING_cmd_charity_delete("delete-charity",
+                                                                         
"post-charity", // cmd trait reference
+                                                                         
&bearer,
+                                                                         
MHD_HTTP_NO_CONTENT),
       /* End the suite. */
       TALER_TESTING_cmd_end ()
     };
diff --git a/src/testing/testing_api_cmd_charities_get.c 
b/src/testing/testing_api_cmd_charities_get.c
index d4aa1f7..7fc170b 100644
--- a/src/testing/testing_api_cmd_charities_get.c
+++ b/src/testing/testing_api_cmd_charities_get.c
@@ -105,7 +105,7 @@ status_run (void *cls,
 
   ss->cgh = DONAU_charities_get (
     TALER_TESTING_interpreter_get_context (is),
-       "http://localhost:8080/";, //TODO: TALER_TESTING_get_donau_url (is),
+         TALER_TESTING_get_donau_url (is),
     ss->bearer,
     &charities_status_cb,
     ss);
diff --git a/src/testing/testing_api_cmd_charity_delete.c 
b/src/testing/testing_api_cmd_charity_delete.c
index 229d6e2..b4536a8 100644
--- a/src/testing/testing_api_cmd_charity_delete.c
+++ b/src/testing/testing_api_cmd_charity_delete.c
@@ -58,6 +58,11 @@ struct StatusState
    */
   struct TALER_TESTING_Interpreter *is;
 
+  /**
+   * Reference to charity post command.
+   */
+  const char *charity_reference;
+
 };
 
 
@@ -109,9 +114,28 @@ status_run (void *cls,
 
   ss->is = is;
 
+  /* Get charity id from trait */
+  {
+         const struct TALER_TESTING_Command *charity_post_cmd;
+         const unsigned long long *charity_id;
+
+         charity_post_cmd = TALER_TESTING_interpreter_lookup_command (is,
+                                                                               
                                  ss->charity_reference);
+
+         if (GNUNET_OK !=
+             TALER_TESTING_get_trait_charity_id (charity_post_cmd,
+                         &charity_id))
+         {
+           GNUNET_break (0);
+           TALER_TESTING_interpreter_fail (is);
+           return;
+         }
+         ss->charity_id = (uint64_t) *(charity_id);
+  }
+
   ss->cgh = DONAU_charity_delete (
     TALER_TESTING_interpreter_get_context (is),
-       "http://localhost:8080/";, //TODO: TALER_TESTING_get_donau_url (is),
+         TALER_TESTING_get_donau_url (is),
     ss->charity_id,
     ss->bearer,
     &charity_status_cb,
@@ -145,16 +169,16 @@ status_cleanup (void *cls,
 
 struct TALER_TESTING_Command
 TALER_TESTING_cmd_charity_delete (const char *label,
-                                                               const uint64_t 
charity_id,
-                                                               const struct 
DONAU_BearerToken *bearer,
-                unsigned int expected_response_code)
+                                                                 const char 
*charity_reference,
+                                                                 const struct 
DONAU_BearerToken *bearer,
+                                                                 unsigned int 
expected_response_code)
 {
   struct StatusState *ss;
 
   ss = GNUNET_new (struct StatusState);
   ss->expected_response_code = expected_response_code;
   ss->bearer = bearer;
-  ss->charity_id = charity_id;
+  ss->charity_reference = charity_reference;
   {
     struct TALER_TESTING_Command cmd = {
       .cls = ss,
diff --git a/src/testing/testing_api_cmd_charity_get.c 
b/src/testing/testing_api_cmd_charity_get.c
index ac4ff23..f99082a 100644
--- a/src/testing/testing_api_cmd_charity_get.c
+++ b/src/testing/testing_api_cmd_charity_get.c
@@ -134,7 +134,7 @@ status_run (void *cls,
 
   ss->cgh = DONAU_charity_get (
     TALER_TESTING_interpreter_get_context (is),
-       "http://localhost:8080/";, //TODO: TALER_TESTING_get_donau_url (is),
+       TALER_TESTING_get_donau_url (is),
     ss->charity_id,
     ss->bearer,
     &charity_status_cb,
@@ -168,7 +168,6 @@ status_cleanup (void *cls,
 
 struct TALER_TESTING_Command
 TALER_TESTING_cmd_charity_get (const char *label,
-                                                               const uint64_t 
charity_id,
                                                                const char 
*charity_reference,
                                                                const struct 
DONAU_BearerToken *bearer,
                                 unsigned int expected_response_code)
@@ -177,7 +176,6 @@ TALER_TESTING_cmd_charity_get (const char *label,
   ss = GNUNET_new (struct StatusState);
   ss->expected_response_code = expected_response_code;
   ss->bearer = bearer;
-  ss->charity_id = charity_id;
   ss->charity_reference = charity_reference;
   {
     struct TALER_TESTING_Command cmd = {
diff --git a/src/testing/testing_api_cmd_charity_post.c 
b/src/testing/testing_api_cmd_charity_post.c
index d086b0d..2702fa2 100644
--- a/src/testing/testing_api_cmd_charity_post.c
+++ b/src/testing/testing_api_cmd_charity_post.c
@@ -122,7 +122,7 @@ status_run (void *cls,
 
   ss->cph = DONAU_charity_post (
     TALER_TESTING_interpreter_get_context (is),
-    "http://localhost:8080/";, // TODO: TALER_TESTING_get_donau_url (is),
+    TALER_TESTING_get_donau_url (is),
     &ss->charity_req,
     ss->bearer,
     &charity_status_cb,
diff --git a/src/testing/testing_api_cmd_get_donau.c 
b/src/testing/testing_api_cmd_get_donau.c
index 9736b85..2f36c3b 100644
--- a/src/testing/testing_api_cmd_get_donau.c
+++ b/src/testing/testing_api_cmd_get_donau.c
@@ -75,34 +75,37 @@ cert_cb (void *cls,
          struct DONAU_Keys *keys)
 {
   struct GetDonauState *ges = cls;
-  const struct DONAU_HttpResponse *hr = &kr->hr;
+  //const struct DONAU_HttpResponse *hr = &kr->hr;
   struct TALER_TESTING_Interpreter *is = ges->is;
 
   ges->donau = NULL;
   ges->keys = keys;
-  switch (hr->http_status)
-  {
-  case MHD_HTTP_OK:
-    if (ges->wait_for_keys)
-    {
-      ges->wait_for_keys = false;
-      TALER_TESTING_interpreter_next (is);
-      return;
-    }
-    return;
-  default:
-    GNUNET_break (0);
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "/keys responded with HTTP status %u\n",
-                hr->http_status);
-    if (ges->wait_for_keys)
-    {
-      ges->wait_for_keys = false;
-      TALER_TESTING_interpreter_fail (is);
-      return;
-    }
-    return;
-  }
+//  switch (hr->http_status)
+//  {
+//  case MHD_HTTP_OK:
+//    if (ges->wait_for_keys)
+//    {
+//      ges->wait_for_keys = false;
+//      TALER_TESTING_interpreter_next (is);
+//      return;
+//    }
+//    return;
+//  default:
+//    GNUNET_break (0);
+//    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+//                "/keys responded with HTTP status %u\n",
+//                hr->http_status);
+//    if (ges->wait_for_keys)
+//    {
+//      ges->wait_for_keys = false;
+//      TALER_TESTING_interpreter_fail (is);
+//      return;
+//    }
+//    return;
+//  }
+
+        TALER_TESTING_interpreter_next (is); // to delete... only temporary
+        return;
 }
 
 
@@ -186,33 +189,17 @@ get_donau_traits (void *cls,
                   unsigned int index)
 {
   struct GetDonauState *ges = cls;
-  // unsigned int off = (NULL == ges->master_priv_file) ? 1 : 0;
-  unsigned int off = 1;
 
-  if (NULL != ges->keys)
-  {
-    struct TALER_TESTING_Trait traits[] = {
-      TALER_TESTING_make_trait_donau_url (ges->donau_url),
-      TALER_TESTING_trait_end ()
-    };
+  struct TALER_TESTING_Trait traits[] = {
+    TALER_TESTING_make_trait_donau_url (ges->donau_url),
+    TALER_TESTING_trait_end ()
+  };
 
-    return TALER_TESTING_get_trait (&traits[off],
-                                    ret,
-                                    trait,
-                                    index);
-  }
-  else
-  {
-    struct TALER_TESTING_Trait traits[] = {
-      TALER_TESTING_make_trait_donau_url (ges->donau_url),
-      TALER_TESTING_trait_end ()
-    };
+  return TALER_TESTING_get_trait (traits,
+                                                                 ret,
+                                                                 trait,
+                                                                 index);
 
-    return TALER_TESTING_get_trait (&traits[off],
-                                    ret,
-                                    trait,
-                                    index);
-  }
 }
 
 
@@ -226,7 +213,7 @@ static char *
 get_donau_base_url (
   const struct GNUNET_CONFIGURATION_Handle *cfg)
 {
-  char *donau_url; // = "http://localhost:8080/";;
+  char *donau_url;// = "http://localhost:8080/";;
 
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_string (cfg,
@@ -247,8 +234,7 @@ struct TALER_TESTING_Command
 TALER_TESTING_cmd_get_donau (
   const char *label,
   const struct GNUNET_CONFIGURATION_Handle *cfg,
-  bool wait_for_keys,
-  bool load_private_key)
+  bool wait_for_keys)
 {
   struct GetDonauState *ges;
 
diff --git a/src/testing/testing_api_loop.c b/src/testing/testing_api_loop.c
index 3b9acaf..4a153b4 100644
--- a/src/testing/testing_api_loop.c
+++ b/src/testing/testing_api_loop.c
@@ -45,15 +45,26 @@ DONAU_TESTING_main (char *const *argv,
   GNUNET_log_setup (argv[0],
                     loglevel,
                     NULL);
-  //if (GNUNET_OK !=
-  //    TALER_TESTING_get_credentials (cfg_file,
-  //                                   exchange_account_section,
-  //                                   bs,
-  //                                   cred))
-  //{
-  //  GNUNET_break (0);
-  //  return 77;
-  //}
+  cred->cfg = GNUNET_CONFIGURATION_create ();
+  if (GNUNET_OK !=
+      GNUNET_CONFIGURATION_load (cred->cfg,
+                                 cfg_file))
+  {
+    GNUNET_break (0);
+    GNUNET_CONFIGURATION_destroy (cred->cfg);
+    return GNUNET_SYSERR;
+  }
+  if (GNUNET_OK !=
+      GNUNET_CONFIGURATION_get_value_string (cred->cfg,
+                                             "donau",
+                                             "BASE_URL",
+                                             &cred->exchange_url))
+  {
+    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+                               "donau",
+                               "BASE_URL");
+    return GNUNET_SYSERR;
+  }
   // if (GNUNET_OK !=
   //    TALER_TESTING_cleanup_files_cfg (NULL,
   //                                     cred->cfg))

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