[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-donau] 02/03: [testing] load and use BASE_URL from config file
From: |
gnunet |
Subject: |
[taler-donau] 02/03: [testing] load and use BASE_URL from config file |
Date: |
Tue, 12 Mar 2024 09:17:45 +0100 |
This is an automated email from the git hooks/post-receive script.
lukas-matyja pushed a commit to branch master
in repository donau.
commit ec58ff7406578940de826747dd3b14414b7b2825
Author: Matyja Lukas Adam <lukas.matyja@students.bfh.ch>
AuthorDate: Tue Mar 12 09:18:17 2024 +0100
[testing] load and use BASE_URL from config file
---
src/include/donau_testing_lib.h | 4 +-
src/testing/test_donau_api.c | 15 +----
src/testing/testing_api_cmd_charities_get.c | 2 +-
src/testing/testing_api_cmd_charity_delete.c | 2 +-
src/testing/testing_api_cmd_charity_get.c | 2 +-
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, 65 insertions(+), 79 deletions(-)
diff --git a/src/include/donau_testing_lib.h b/src/include/donau_testing_lib.h
index 9405ebb..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.
diff --git a/src/testing/test_donau_api.c b/src/testing/test_donau_api.c
index 45b4856..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",
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 a97890e..b4536a8 100644
--- a/src/testing/testing_api_cmd_charity_delete.c
+++ b/src/testing/testing_api_cmd_charity_delete.c
@@ -135,7 +135,7 @@ status_run (void *cls,
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,
diff --git a/src/testing/testing_api_cmd_charity_get.c
b/src/testing/testing_api_cmd_charity_get.c
index 8b78e2f..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,
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.