commit c2f180c829fca707656128ff10327c4271a06f35
parent 8b28a13e6bcb5550415d80cae5657bd2a106da10
Author: bohdan-potuzhnyi <bohdan.potuzhnyi@gmail.com>
Date: Sun, 15 Dec 2024 19:19:12 +0100
adding the tests for the post
Diffstat:
5 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/src/include/taler_merchant_testing_lib.h b/src/include/taler_merchant_testing_lib.h
@@ -1810,6 +1810,24 @@ TALER_TESTING_cmd_merchant_get_donau_instances(const char *label,
...);
+/**
+ * Define a "POST /donau" CMD.
+ *
+ * @param label command label.
+ * @param url base URL of the Donau service serving the
+ * GET /donau_instances request.
+ * @param expected_http_status expected HTTP response code.
+ * @param ... NULL-terminated list of labels (const char *) of
+ * donau instances (commands) we expect to be returned in the list
+ * (assuming @a expected_http_status is #MHD_HTTP_OK)
+ * @return the command.
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_merchant_post_donau_instance(const char *label,
+ const char *url,
+ unsigned int expected_http_status,
+ ...);
+
/* ****** Specific traits supported by this component ******* */
diff --git a/src/lib/merchant_api_post_donau_instance.c b/src/lib/merchant_api_post_donau_instance.c
@@ -195,7 +195,7 @@ TALER_MERCHANT_donau_instances_post (
dph->cb = cb;
dph->cb_cls = cb_cls;
dph->url = TALER_url_join (backend_url,
- "donau",
+ "private/donau",
NULL);
if (NULL == dph->url)
diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am
@@ -65,6 +65,7 @@ libtalermerchanttesting_la_SOURCES = \
testing_api_cmd_patch_webhook.c \
testing_api_cmd_pay_order.c \
testing_api_cmd_post_account.c \
+ testing_api_cmd_post_donau_instances.c \
testing_api_cmd_post_instances.c \
testing_api_cmd_post_orders_paid.c \
testing_api_cmd_post_orders.c \
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c
@@ -1821,6 +1821,14 @@ run (void *cls,
"get-donau-instance",
merchant_url,
MHD_HTTP_OK),
+ TALER_TESTING_cmd_merchant_post_donau_instance(
+ "post-donau-instance",
+ merchant_url,
+ MHD_HTTP_NO_CONTENT),
+ TALER_TESTING_cmd_merchant_get_donau_instances(
+ "get-donau-instances-after-delete",
+ merchant_url,
+ MHD_HTTP_OK),
TALER_TESTING_cmd_end ()
};
diff --git a/src/testing/testing_api_cmd_get_donau_instances.c b/src/testing/testing_api_cmd_get_donau_instances.c
@@ -188,7 +188,6 @@ TALER_TESTING_cmd_merchant_get_donau_instances(const char *label,
gis->expected_http_status = expected_http_status;
gis->instances_length = 0;
- const char *instance_label;
va_list ap;
va_start(ap, expected_http_status);
// while (NULL != (instance_label = va_arg(ap, const char *)))