aboutsummaryrefslogtreecommitdiff
path: root/src/testing/test_merchant_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-12-29 14:47:17 +0100
committerChristian Grothoff <christian@grothoff.org>2022-12-29 14:47:17 +0100
commit2c19f6a6fb180f059fcaeb193dd387c4d6af21b1 (patch)
treed7fdd874e84950510f5a7a698007023ed46d80ea /src/testing/test_merchant_api.c
parent689bbc7a201067815cb0975703422854099d19ba (diff)
downloadmerchant-2c19f6a6fb180f059fcaeb193dd387c4d6af21b1.tar.gz
merchant-2c19f6a6fb180f059fcaeb193dd387c4d6af21b1.tar.bz2
merchant-2c19f6a6fb180f059fcaeb193dd387c4d6af21b1.zip
-towards fixing the template tests
Diffstat (limited to 'src/testing/test_merchant_api.c')
-rw-r--r--src/testing/test_merchant_api.c201
1 files changed, 115 insertions, 86 deletions
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c
index a4a6dfd9..a53ec442 100644
--- a/src/testing/test_merchant_api.c
+++ b/src/testing/test_merchant_api.c
@@ -1299,79 +1299,133 @@ run (void *cls,
MHD_HTTP_OK,
NULL),
TALER_TESTING_cmd_merchant_post_templates ("post-templates-t1",
- merchant_url,
- "template-1",
- "a template",
- MHD_HTTP_NO_CONTENT),
+ merchant_url,
+ "template-1",
+ "a template",
+ MHD_HTTP_NO_CONTENT),
TALER_TESTING_cmd_merchant_post_templates ("post-templates-t1-idem",
- merchant_url,
- "template-1",
- "a template",
- MHD_HTTP_NO_CONTENT),
+ merchant_url,
+ "template-1",
+ "a template",
+ MHD_HTTP_NO_CONTENT),
TALER_TESTING_cmd_merchant_post_templates ("post-templates-t1-non-idem",
- merchant_url,
- "template-1",
- "a different template",
- MHD_HTTP_CONFLICT),
+ merchant_url,
+ "template-1",
+ "a different template",
+ MHD_HTTP_CONFLICT),
TALER_TESTING_cmd_merchant_get_templates ("get-templates-t1",
+ merchant_url,
+ MHD_HTTP_OK,
+ "post-templates-t1",
+ NULL),
+ TALER_TESTING_cmd_merchant_get_template ("get-template-t1",
merchant_url,
+ "template-1",
MHD_HTTP_OK,
- "post-templates-t1",
- NULL),
- TALER_TESTING_cmd_merchant_get_template ("get-template-t1",
- merchant_url,
- "template-1",
- MHD_HTTP_OK,
- "post-templates-t1"),
+ "post-templates-t1"),
TALER_TESTING_cmd_merchant_post_templates ("post-templates-t2",
- merchant_url,
- "template-2",
- "a template",
- MHD_HTTP_NO_CONTENT),
- TALER_TESTING_cmd_merchant_patch_template ("patch-templates-t2",
- merchant_url,
- "template-2",
- "another template",
- "data:image/jpeg;base64,RAWDATA",
- json_pack ("{s:s}",
- "summary",
- "EUR"),
- MHD_HTTP_NO_CONTENT),
+ merchant_url,
+ "template-2",
+ "a template",
+ MHD_HTTP_NO_CONTENT),
+ TALER_TESTING_cmd_merchant_patch_template (
+ "patch-templates-t2",
+ merchant_url,
+ "template-2",
+ "another template",
+ "data:image/jpeg;base64,RAWDATA",
+ json_pack ("{s:s}",
+ "summary",
+ "my new summary"),
+ MHD_HTTP_NO_CONTENT),
TALER_TESTING_cmd_merchant_get_template ("get-template-t2",
- merchant_url,
- "template-2",
- MHD_HTTP_OK,
- "patch-templates-t2"),
+ merchant_url,
+ "template-2",
+ MHD_HTTP_OK,
+ "patch-templates-t2"),
TALER_TESTING_cmd_merchant_get_template ("get-template-nx",
- merchant_url,
- "template-nx",
- MHD_HTTP_NOT_FOUND,
- NULL),
- TALER_TESTING_cmd_merchant_patch_template ("patch-templates-t3-nx",
- merchant_url,
- "template-3",
- "updated template",
- "data:image/jpeg;base64,RAWDATA",
- json_pack ("{s:s}",
- "summary",
- "EUR"),
- MHD_HTTP_NOT_FOUND),
+ merchant_url,
+ "template-nx",
+ MHD_HTTP_NOT_FOUND,
+ NULL),
+ TALER_TESTING_cmd_merchant_patch_template (
+ "patch-templates-t3-nx",
+ merchant_url,
+ "template-3",
+ "updated template",
+ "data:image/jpeg;base64,RAWDATA",
+ json_pack ("{s:s}",
+ "summary",
+ "my new summary"),
+ MHD_HTTP_NOT_FOUND),
+ TALER_TESTING_cmd_merchant_post_templates2 (
+ "post-templates-t3-amount",
+ merchant_url,
+ "template-amount",
+ "a different template with an amount",
+ NULL,
+ json_pack ("{s:s}",
+ "amount",
+ "EUR:4"),
+ MHD_HTTP_NO_CONTENT),
+ TALER_TESTING_cmd_merchant_post_using_templates (
+ "using-templates-t1",
+ "post-templates-t1",
+ merchant_url,
+ "summary-1",
+ "EUR:10",
+ MHD_HTTP_OK),
+ TALER_TESTING_cmd_merchant_post_using_templates (
+ "using-templates-t1-amount-missing",
+ "post-templates-t1",
+ merchant_url,
+ "summary-1",
+ NULL,
+ MHD_HTTP_CONFLICT),
+ TALER_TESTING_cmd_merchant_post_using_templates (
+ "using-templates-t1-summary-missing",
+ "post-templates-t1",
+ merchant_url,
+ NULL,
+ "EUR:10",
+ MHD_HTTP_CONFLICT),
+ TALER_TESTING_cmd_merchant_post_using_templates (
+ "using-templates-t1-amount-conflict",
+ "post-templates-t3-amount",
+ merchant_url,
+ "summary-1",
+ "EUR:10",
+ MHD_HTTP_CONFLICT),
+ TALER_TESTING_cmd_merchant_post_using_templates (
+ "using-templates-t1-amount-duplicate",
+ "post-templates-t3-amount",
+ merchant_url,
+ "summary-1",
+ "EUR:4",
+ MHD_HTTP_CONFLICT),
TALER_TESTING_cmd_merchant_delete_template ("get-templates-empty",
- merchant_url,
- "t1",
- MHD_HTTP_NOT_FOUND),
+ merchant_url,
+ "t1",
+ MHD_HTTP_NOT_FOUND),
TALER_TESTING_cmd_merchant_delete_template ("get-templates-empty",
- merchant_url,
- "template-1",
- MHD_HTTP_NO_CONTENT),
+ merchant_url,
+ "template-1",
+ MHD_HTTP_NO_CONTENT),
+ TALER_TESTING_cmd_merchant_post_using_templates (
+ "post-templates-t1-deleted",
+ "post-templates-t1",
+ merchant_url,
+ "summary-1",
+ "EUR:5",
+ MHD_HTTP_NOT_FOUND),
TALER_TESTING_cmd_end ()
- };
+ };
- struct TALER_TESTING_Command webhooks[] = {
+ struct TALER_TESTING_Command webhooks[] = {
TALER_TESTING_cmd_merchant_get_webhooks ("get-webhooks-empty",
- merchant_url,
- MHD_HTTP_OK,
- NULL),
+ merchant_url,
+ MHD_HTTP_OK,
+ NULL),
TALER_TESTING_cmd_merchant_post_webhooks ("post-webhooks-w1",
merchant_url,
"webhook-1",
@@ -1439,31 +1493,8 @@ run (void *cls,
"webhook-1",
MHD_HTTP_NO_CONTENT),
TALER_TESTING_cmd_end ()
- };
+ };
- struct TALER_TESTING_Command using_templates[] = {
- TALER_TESTING_cmd_merchant_post_using_templates ("post-templates-t1",
- merchant_url,
- "template-1",
- "EUR:10",
- MHD_HTTP_NO_CONTENT),
- TALER_TESTING_cmd_merchant_post_using_templates ("post-templates-t1-idem",
- merchant_url,
- "template-1",
- "EUR:10",
- MHD_HTTP_NO_CONTENT),
- TALER_TESTING_cmd_merchant_post_using_templates ("post-templates-t1-non-idem",
- merchant_url,
- "template-1",
- "EUR:5",
- MHD_HTTP_CONFLICT),
- TALER_TESTING_cmd_merchant_post_using_templates ("post-templates-t2",
- merchant_url,
- "template-2",
- "EUR:10",
- MHD_HTTP_NO_CONTENT),
- TALER_TESTING_cmd_end ()
- };
struct TALER_TESTING_Command commands[] = {
/* general setup */
@@ -1819,8 +1850,6 @@ run (void *cls,
templates),
TALER_TESTING_cmd_batch ("webhooks",
webhooks),
- TALER_TESTING_cmd_batch ("using_templates",
- using_templates),
/**
* End the suite.
*/