aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpriscilla <priscilla.huang@efrei.net>2022-12-12 08:38:08 -0500
committerpriscilla <priscilla.huang@efrei.net>2022-12-12 08:38:08 -0500
commit23e06d71884b593cc7e379cafece085be1680d53 (patch)
treef923de150476b90b38c47abaa0a99511ccc739b4
parentc903b08437ccb6109491ed5e0a9bcb835ab034ef (diff)
downloadmerchant-23e06d71884b593cc7e379cafece085be1680d53.tar.gz
merchant-23e06d71884b593cc7e379cafece085be1680d53.tar.bz2
merchant-23e06d71884b593cc7e379cafece085be1680d53.zip
testing webhooks
-rw-r--r--src/testing/test_kyc_api.c2
-rw-r--r--src/testing/test_merchant_api.c76
2 files changed, 77 insertions, 1 deletions
diff --git a/src/testing/test_kyc_api.c b/src/testing/test_kyc_api.c
index 268b042c..5d47d9ba 100644
--- a/src/testing/test_kyc_api.c
+++ b/src/testing/test_kyc_api.c
@@ -6,7 +6,7 @@
it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 3, or
(at your option) any later version.
-
+
TALER is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c
index f99fb7b8..f6fb28a3 100644
--- a/src/testing/test_merchant_api.c
+++ b/src/testing/test_merchant_api.c
@@ -1367,6 +1367,80 @@ run (void *cls,
TALER_TESTING_cmd_end ()
};
+ struct TALER_TESTING_Command webhooks[] = {
+ TALER_TESTING_cmd_merchant_get_webhooks ("get-webhooks-empty",
+ merchant_url,
+ MHD_HTTP_OK,
+ NULL),
+ TALER_TESTING_cmd_merchant_post_webhooks ("post-webhooks-w1",
+ merchant_url,
+ "webhook-1",
+ "Paid",
+ MHD_HTTP_NO_CONTENT),
+ TALER_TESTING_cmd_merchant_post_webhooks ("post-webhooks-w1-idem",
+ merchant_url,
+ "webhook-1",
+ "Paid",
+ MHD_HTTP_NO_CONTENT),
+ TALER_TESTING_cmd_merchant_post_webhooks ("post-webhooks-w1-non-idem",
+ merchant_url,
+ "webhook-1",
+ "Refund",
+ MHD_HTTP_CONFLICT),
+ TALER_TESTING_cmd_merchant_get_webhooks ("get-webhooks-w1",
+ merchant_url,
+ MHD_HTTP_OK,
+ "post-webhooks-w1",
+ NULL),
+ TALER_TESTING_cmd_merchant_get_webhook ("get-webhook-w1",
+ merchant_url,
+ "webhook-1",
+ MHD_HTTP_OK,
+ "post-webhooks-w1"),
+ TALER_TESTING_cmd_merchant_post_webhooks ("post-webhooks-w2",
+ merchant_url,
+ "webhook-2",
+ "Paid",
+ MHD_HTTP_NO_CONTENT),
+ TALER_TESTING_cmd_merchant_patch_webhook ("patch-webhooks-w2",
+ merchant_url,
+ "webhook-2",
+ "Refund2",
+ "https://example.com",
+ "POST",
+ "Authorization:WHWOXZXPLL",
+ "Amount",
+ MHD_HTTP_NO_CONTENT),
+ TALER_TESTING_cmd_merchant_get_webhook ("get-webhook-w2",
+ merchant_url,
+ "webhook-2",
+ MHD_HTTP_OK,
+ "patch-webhooks-w2"),
+ TALER_TESTING_cmd_merchant_get_webhook ("get-webhook-nx",
+ merchant_url,
+ "webhook-nx",
+ MHD_HTTP_NOT_FOUND,
+ NULL),
+ TALER_TESTING_cmd_merchant_patch_webhook ("patch-webhooks-w3-nx",
+ merchant_url,
+ "webhook-3",
+ "Paid2",
+ "https://example.com",
+ "POST",
+ "Authorization:WHWOXZXPLL",
+ "Amount",
+ MHD_HTTP_NOT_FOUND),
+ TALER_TESTING_cmd_merchant_delete_webhook ("get-webhooks-empty",
+ merchant_url,
+ "w1",
+ MHD_HTTP_NOT_FOUND),
+ TALER_TESTING_cmd_merchant_delete_webhook ("get-webhooks-empty",
+ merchant_url,
+ "webhook-1",
+ MHD_HTTP_NO_CONTENT),
+ TALER_TESTING_cmd_end ()
+ };
+
struct TALER_TESTING_Command commands[] = {
/* general setup */
TALER_TESTING_cmd_auditor_add ("add-auditor-OK",
@@ -1719,6 +1793,8 @@ run (void *cls,
auth),
TALER_TESTING_cmd_batch ("templates",
templates),
+ TALER_TESTING_cmd_batch ("webhooks",
+ webhooks),
/**
* End the suite.
*/