[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-donau] 01/03: [testing] use charity id trait
From: |
gnunet |
Subject: |
[taler-donau] 01/03: [testing] use charity id trait |
Date: |
Tue, 12 Mar 2024 09:17:44 +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 3fbd9fa650a74eeb0b438f7e2af77b788d00a880
Author: Matyja Lukas Adam <lukas.matyja@students.bfh.ch>
AuthorDate: Mon Mar 11 22:43:23 2024 +0100
[testing] use charity id trait
---
src/include/donau_testing_lib.h | 3 +--
src/testing/test_donau_api.c | 9 ++++----
src/testing/testing_api_cmd_charity_delete.c | 32 ++++++++++++++++++++++++----
src/testing/testing_api_cmd_charity_get.c | 2 --
4 files changed, 33 insertions(+), 13 deletions(-)
diff --git a/src/include/donau_testing_lib.h b/src/include/donau_testing_lib.h
index f9cbb76..9405ebb 100644
--- a/src/include/donau_testing_lib.h
+++ b/src/include/donau_testing_lib.h
@@ -62,7 +62,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 +87,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..45b4856 100644
--- a/src/testing/test_donau_api.c
+++ b/src/testing/test_donau_api.c
@@ -94,17 +94,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_charity_delete.c
b/src/testing/testing_api_cmd_charity_delete.c
index 229d6e2..a97890e 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,6 +114,25 @@ 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),
@@ -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..8b78e2f 100644
--- a/src/testing/testing_api_cmd_charity_get.c
+++ b/src/testing/testing_api_cmd_charity_get.c
@@ -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 = {
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.