donau

Donation authority for GNU Taler (experimental)
Log | Files | Refs | Submodules | README | LICENSE

commit fa32efcd5c7aff8be7bebca785279d7289edc019
parent 9b889f3b1f2e49edc74933e9e85aa8e01b1d1c37
Author: Matyja Lukas Adam <lukas.matyja@students.bfh.ch>
Date:   Wed,  6 Mar 2024 10:38:04 +0100

[testing] charity post some changes

Diffstat:
Msrc/testing/test_donau_api.c | 28++++++++++++++--------------
Msrc/testing/testing_api_cmd_charity_post.c | 48++++++++++++++++++++++++------------------------
2 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/src/testing/test_donau_api.c b/src/testing/test_donau_api.c @@ -84,25 +84,25 @@ run (void *cls, // cred.cfg, // true, // true), -// TALER_TESTING_cmd_charity_post ("post-charity", -// "EBETNXT9ZF606FRF3WD5N6G2XVD5QHDP2PTQD4GSX4VEN2YYG2C0", -// "example", -// "example.com", -// "EUR:10", // max_per_year -// "EUR:0", // receipts_to_date -// 2024, // current year -// bearer, -// MHD_HTTP_NO_CONTENT), + TALER_TESTING_cmd_charity_post ("post-charity", + "EBETNXT9ZF606FRF3WD5N6G2XVD5QHDP2PTQD4GSX4VEN2YYG2C0", + "example", + "example.com", + "EUR:10", // max_per_year + "EUR:0", // receipts_to_date + 2024, // current year + bearer, + MHD_HTTP_NO_CONTENT), TALER_TESTING_cmd_charity_get ("get-charity-by-id", - 4, + 5, bearer, MHD_HTTP_OK), TALER_TESTING_cmd_charities_get ("get-charities", MHD_HTTP_OK), - TALER_TESTING_cmd_charity_delete("delete-charity", - 4, - bearer, - MHD_HTTP_NO_CONTENT), +// TALER_TESTING_cmd_charity_delete("delete-charity", +// 5, +// bearer, +// MHD_HTTP_NO_CONTENT), //TODO: test POST charity, DELETE charity /* End the suite. */ diff --git a/src/testing/testing_api_cmd_charity_post.c b/src/testing/testing_api_cmd_charity_post.c @@ -156,32 +156,32 @@ TALER_TESTING_cmd_charity_post (const char *label, { struct StatusState *ss; ss = GNUNET_new (struct StatusState); - //memcpy(ss->charity_req->charity_pub.eddsa_pub.q_y, charity_pub, (256/8)*sizeof(char)); - //ss->charity_req->name = GNUNET_strdup (name); - //ss->charity_req->charity_url = GNUNET_strdup (url); + GNUNET_memcpy(&ss->charity_req->charity_pub.eddsa_pub.q_y, charity_pub, sizeof(ss->charity_req->charity_pub.eddsa_pub.q_y)); + ss->charity_req->name = GNUNET_strdup (name); + ss->charity_req->charity_url = GNUNET_strdup (url); // parse string max_per_year to amount -// if (GNUNET_OK != -// TALER_string_to_amount (max_per_year, -// &ss->charity_req->max_per_year)) -// { -// GNUNET_log (GNUNET_ERROR_TYPE_ERROR, -// "Failed to parse amount `%s' at %s\n", -// max_per_year, -// label); -// GNUNET_assert (0); -// } + if (GNUNET_OK != + TALER_string_to_amount (max_per_year, + &ss->charity_req->max_per_year)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Failed to parse amount `%s' at %s\n", + max_per_year, + label); + GNUNET_assert (0); + } // parse string receipts_to_date to amount -// if (GNUNET_OK != -// TALER_string_to_amount (receipts_to_date, -// &ss->charity_req->receipts_to_date)) -// { -// GNUNET_log (GNUNET_ERROR_TYPE_ERROR, -// "Failed to parse amount `%s' at %s\n", -// receipts_to_date, -// label); -// GNUNET_assert (0); -// } -// ss->charity_req->current_year = current_year; + if (GNUNET_OK != + TALER_string_to_amount (receipts_to_date, + &ss->charity_req->receipts_to_date)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Failed to parse amount `%s' at %s\n", + receipts_to_date, + label); + GNUNET_assert (0); + } + ss->charity_req->current_year = current_year; ss->expected_response_code = expected_response_code; ss->bearer = bearer; {