diff options
author | Christian Grothoff <christian@grothoff.org> | 2024-02-24 13:23:20 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2024-02-24 13:23:20 +0100 |
commit | 70a44acf8458cfed17191950cb41e69b6f06e64d (patch) | |
tree | d32dff3352f4eb417d50386e24302514c020f178 /src/testing/test_merchant_api.c | |
parent | a84dbc0e60adbc27f4f98a024c469dd51df8f817 (diff) |
expand test for #8353
Diffstat (limited to 'src/testing/test_merchant_api.c')
-rw-r--r-- | src/testing/test_merchant_api.c | 548 |
1 files changed, 303 insertions, 245 deletions
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c index cff12442..48e8cec4 100644 --- a/src/testing/test_merchant_api.c +++ b/src/testing/test_merchant_api.c @@ -1500,6 +1500,7 @@ run (void *cls, cred.cfg, merchant_url, MHD_HTTP_OK, + "repurchase-original", GNUNET_TIME_relative_to_timestamp (GNUNET_TIME_UNIT_MINUTES), GNUNET_TIME_UNIT_FOREVER_TS, "https://fulfillment.example.com/", @@ -1534,6 +1535,7 @@ run (void *cls, cred.cfg, merchant_url, MHD_HTTP_OK, + "repurchase-secondary", GNUNET_TIME_relative_to_timestamp (GNUNET_TIME_UNIT_MINUTES), GNUNET_TIME_UNIT_FOREVER_TS, "https://fulfillment.example.com/", @@ -1554,150 +1556,189 @@ run (void *cls, "repurchase-session", "post-order-repurchase-original", MHD_HTTP_OK), + TALER_TESTING_cmd_merchant_order_refund ( + "refund-repurchased", + merchant_url, + "refund repurchase", + "repurchase-original", + "EUR:1.0", + MHD_HTTP_OK), + TALER_TESTING_cmd_merchant_get_order3 ( + "repurchase-check-secondary-payment", + merchant_url, + "post-order-repurchase-secondary", + TALER_MERCHANT_OSC_CLAIMED, + "repurchase-session", + NULL, + MHD_HTTP_OK), TALER_TESTING_cmd_end () }; struct TALER_TESTING_Command commands[] = { /* general setup */ - TALER_TESTING_cmd_run_fakebank ("run-fakebank", - cred.cfg, - "exchange-account-exchange"), - TALER_TESTING_cmd_system_start ("start-taler", - config_file, - "-ema", - "-u", "exchange-account-exchange", - NULL), - TALER_TESTING_cmd_get_exchange ("get-exchange", - cred.cfg, - NULL, - true, - true), - TALER_TESTING_cmd_batch ("orders-id", - get_private_order_id), - TALER_TESTING_cmd_config ("config", - merchant_url, - MHD_HTTP_OK), - TALER_TESTING_cmd_merchant_get_instances ("instances-empty", - merchant_url, - MHD_HTTP_OK, - NULL), - TALER_TESTING_cmd_merchant_post_instances ("instance-create-default-setup", - merchant_url, - "default", - MHD_HTTP_NO_CONTENT), + TALER_TESTING_cmd_run_fakebank ( + "run-fakebank", + cred.cfg, + "exchange-account-exchange"), + TALER_TESTING_cmd_system_start ( + "start-taler", + config_file, + "-ema", + "-u", "exchange-account-exchange", + NULL), + TALER_TESTING_cmd_get_exchange ( + "get-exchange", + cred.cfg, + NULL, + true, + true), + TALER_TESTING_cmd_batch ( + "orders-id", + get_private_order_id), + TALER_TESTING_cmd_config ( + "config", + merchant_url, + MHD_HTTP_OK), + TALER_TESTING_cmd_merchant_get_instances ( + "instances-empty", + merchant_url, + MHD_HTTP_OK, + NULL), + TALER_TESTING_cmd_merchant_post_instances ( + "instance-create-default-setup", + merchant_url, + "default", + MHD_HTTP_NO_CONTENT), TALER_TESTING_cmd_merchant_post_account ( "instance-create-default-account", merchant_url, PAYTO_I1, NULL, NULL, MHD_HTTP_OK), - TALER_TESTING_cmd_merchant_post_instances ("instance-create-i1", - merchant_url, - "i1", - MHD_HTTP_NO_CONTENT), - TALER_TESTING_cmd_merchant_get_instances ("instances-get-i1", - merchant_url, - MHD_HTTP_OK, - "instance-create-i1", - "instance-create-default-setup", - NULL), - TALER_TESTING_cmd_merchant_get_instance ("instances-get-i1", - merchant_url, - "i1", - MHD_HTTP_OK, - "instance-create-i1"), - TALER_TESTING_cmd_merchant_patch_instance ("instance-patch-i1", - merchant_url, - "i1", - "bob-the-merchant", - json_pack ("{s:s}", - "street", - "bobstreet"), - json_pack ("{s:s}", - "street", - "bobjuryst"), - true, - GNUNET_TIME_UNIT_MINUTES, - GNUNET_TIME_UNIT_MINUTES, - MHD_HTTP_NO_CONTENT), - TALER_TESTING_cmd_merchant_get_instance ("instances-get-i1-2", - merchant_url, - "i1", - MHD_HTTP_OK, - "instance-patch-i1"), - TALER_TESTING_cmd_merchant_get_instance ("instances-get-i2-nx", - merchant_url, - "i2", - MHD_HTTP_NOT_FOUND, - NULL), - TALER_TESTING_cmd_merchant_post_instances2 ("instance-create-ACL", - merchant_url, - "i-acl", - "controlled instance", - json_pack ("{s:s}", "city", - "shopcity"), - json_pack ("{s:s}", "city", - "lawyercity"), - true, - GNUNET_TIME_UNIT_MINUTES, - GNUNET_TIME_UNIT_MINUTES, - // FIXME: change this back once - // we have a update auth test CMD - // RFC_8959_PREFIX "EXAMPLE", - NULL, - MHD_HTTP_NO_CONTENT), - TALER_TESTING_cmd_merchant_patch_instance ("instance-patch-ACL", - merchant_url, - "i-acl", - "controlled instance", - json_pack ("{s:s}", - "street", - "bobstreet"), - json_pack ("{s:s}", - "street", - "bobjuryst"), - true, - GNUNET_TIME_UNIT_MINUTES, - GNUNET_TIME_UNIT_MINUTES, - MHD_HTTP_NO_CONTENT), - TALER_TESTING_cmd_merchant_post_instances ("instance-create-i2", - merchant_url, - "i2", - MHD_HTTP_NO_CONTENT), - TALER_TESTING_cmd_merchant_post_instances ("instance-create-i2-idem", - merchant_url, - "i2", - MHD_HTTP_NO_CONTENT), - TALER_TESTING_cmd_merchant_delete_instance ("instance-delete-i2", - merchant_url, - "i2", - MHD_HTTP_NO_CONTENT), - TALER_TESTING_cmd_merchant_get_instance ("instances-get-i2-post-deletion", - merchant_url, - "i2", - MHD_HTTP_NOT_FOUND, - NULL), - TALER_TESTING_cmd_merchant_purge_instance ("instance-delete-then-purge-i2", - merchant_url, - "i2", - MHD_HTTP_NO_CONTENT), - TALER_TESTING_cmd_merchant_purge_instance ("instance-purge-i1", - merchant_url, - "i1", - MHD_HTTP_NO_CONTENT), - TALER_TESTING_cmd_merchant_delete_instance ("instance-purge-then-delete-i1", - merchant_url, - "i1", - MHD_HTTP_NOT_FOUND), - TALER_TESTING_cmd_merchant_purge_instance ("instance-purge-i-acl-middle", - merchant_url, - "i-acl", - MHD_HTTP_NO_CONTENT), - TALER_TESTING_cmd_merchant_purge_instance ("instance-purge-default-middle", - merchant_url, - "default", - MHD_HTTP_NO_CONTENT), + TALER_TESTING_cmd_merchant_post_instances ( + "instance-create-i1", + merchant_url, + "i1", + MHD_HTTP_NO_CONTENT), + TALER_TESTING_cmd_merchant_get_instances ( + "instances-get-i1", + merchant_url, + MHD_HTTP_OK, + "instance-create-i1", + "instance-create-default-setup", + NULL), + TALER_TESTING_cmd_merchant_get_instance ( + "instances-get-i1", + merchant_url, + "i1", + MHD_HTTP_OK, + "instance-create-i1"), + TALER_TESTING_cmd_merchant_patch_instance ( + "instance-patch-i1", + merchant_url, + "i1", + "bob-the-merchant", + json_pack ("{s:s}", + "street", + "bobstreet"), + json_pack ("{s:s}", + "street", + "bobjuryst"), + true, + GNUNET_TIME_UNIT_MINUTES, + GNUNET_TIME_UNIT_MINUTES, + MHD_HTTP_NO_CONTENT), + TALER_TESTING_cmd_merchant_get_instance ( + "instances-get-i1-2", + merchant_url, + "i1", + MHD_HTTP_OK, + "instance-patch-i1"), + TALER_TESTING_cmd_merchant_get_instance ( + "instances-get-i2-nx", + merchant_url, + "i2", + MHD_HTTP_NOT_FOUND, + NULL), + TALER_TESTING_cmd_merchant_post_instances2 ( + "instance-create-ACL", + merchant_url, + "i-acl", + "controlled instance", + json_pack ("{s:s}", "city", + "shopcity"), + json_pack ("{s:s}", "city", + "lawyercity"), + true, + GNUNET_TIME_UNIT_MINUTES, + GNUNET_TIME_UNIT_MINUTES, + // FIXME: change this back once + // we have a update auth test CMD + // RFC_8959_PREFIX "EXAMPLE", + NULL, + MHD_HTTP_NO_CONTENT), + TALER_TESTING_cmd_merchant_patch_instance ( + "instance-patch-ACL", + merchant_url, + "i-acl", + "controlled instance", + json_pack ("{s:s}", + "street", + "bobstreet"), + json_pack ("{s:s}", + "street", + "bobjuryst"), + true, + GNUNET_TIME_UNIT_MINUTES, + GNUNET_TIME_UNIT_MINUTES, + MHD_HTTP_NO_CONTENT), + TALER_TESTING_cmd_merchant_post_instances ( + "instance-create-i2", + merchant_url, + "i2", + MHD_HTTP_NO_CONTENT), + TALER_TESTING_cmd_merchant_post_instances ( + "instance-create-i2-idem", + merchant_url, + "i2", + MHD_HTTP_NO_CONTENT), + TALER_TESTING_cmd_merchant_delete_instance ( + "instance-delete-i2", + merchant_url, + "i2", + MHD_HTTP_NO_CONTENT), + TALER_TESTING_cmd_merchant_get_instance ( + "instances-get-i2-post-deletion", + merchant_url, + "i2", + MHD_HTTP_NOT_FOUND, + NULL), + TALER_TESTING_cmd_merchant_purge_instance ( + "instance-delete-then-purge-i2", + merchant_url, + "i2", + MHD_HTTP_NO_CONTENT), + TALER_TESTING_cmd_merchant_purge_instance ( + "instance-purge-i1", + merchant_url, + "i1", + MHD_HTTP_NO_CONTENT), + TALER_TESTING_cmd_merchant_delete_instance ( + "instance-purge-then-delete-i1", + merchant_url, + "i1", + MHD_HTTP_NOT_FOUND), + TALER_TESTING_cmd_merchant_purge_instance ( + "instance-purge-i-acl-middle", + merchant_url, + "i-acl", + MHD_HTTP_NO_CONTENT), + TALER_TESTING_cmd_merchant_purge_instance ( + "instance-purge-default-middle", + merchant_url, + "default", + MHD_HTTP_NO_CONTENT), TALER_TESTING_cmd_merchant_post_instances ( "instance-create-default-after-purge", merchant_url, @@ -1709,119 +1750,136 @@ run (void *cls, PAYTO_I1, NULL, NULL, MHD_HTTP_OK), - TALER_TESTING_cmd_merchant_get_products ("get-products-empty", - merchant_url, - MHD_HTTP_OK, - NULL), - TALER_TESTING_cmd_merchant_post_products ("post-products-p1", - merchant_url, - "product-1", - "a product", - "EUR:1", - MHD_HTTP_NO_CONTENT), - TALER_TESTING_cmd_merchant_post_products ("post-products-p1-idem", - merchant_url, - "product-1", - "a product", - "EUR:1", - MHD_HTTP_NO_CONTENT), - TALER_TESTING_cmd_merchant_post_products ("post-products-p1-non-idem", - merchant_url, - "product-1", - "a different product", - "EUR:1", - MHD_HTTP_CONFLICT), - TALER_TESTING_cmd_merchant_get_products ("get-products-p1", - merchant_url, - MHD_HTTP_OK, - "post-products-p1", - NULL), - TALER_TESTING_cmd_merchant_get_product ("get-product-p1", - merchant_url, - "product-1", - MHD_HTTP_OK, - "post-products-p1"), - TALER_TESTING_cmd_merchant_post_products ("post-products-p2", - merchant_url, - "product-2", - "a product", - "EUR:1", - MHD_HTTP_NO_CONTENT), - TALER_TESTING_cmd_merchant_patch_product ("patch-products-p2", - merchant_url, - "product-2", - "another product", - json_pack ("{s:s}", "en", "text"), - "kg", - "EUR:1", - "data:image/jpeg;base64,RAWDATA", - json_array (), - 40, - 0, - json_pack ("{s:s}", - "street", - "pstreet"), - GNUNET_TIME_relative_to_timestamp ( - GNUNET_TIME_UNIT_MINUTES), - MHD_HTTP_NO_CONTENT), - TALER_TESTING_cmd_merchant_get_product ("get-product-p2", - merchant_url, - "product-2", - MHD_HTTP_OK, - "patch-products-p2"), - TALER_TESTING_cmd_merchant_get_product ("get-product-nx", - merchant_url, - "product-nx", - MHD_HTTP_NOT_FOUND, - NULL), - TALER_TESTING_cmd_merchant_patch_product ("patch-products-p3-nx", - merchant_url, - "product-3", - "nx updated product", - json_pack ("{s:s}", "en", "text"), - "kg", - "EUR:1", - "data:image/jpeg;base64,RAWDATA", - json_array (), - 40, - 0, - json_pack ("{s:s}", - "street", - "pstreet"), - GNUNET_TIME_relative_to_timestamp ( - GNUNET_TIME_UNIT_MINUTES), - MHD_HTTP_NOT_FOUND), - TALER_TESTING_cmd_merchant_delete_product ("get-products-empty", - merchant_url, - "p1", - MHD_HTTP_NOT_FOUND), - TALER_TESTING_cmd_merchant_delete_product ("get-products-empty", - merchant_url, - "product-1", - MHD_HTTP_NO_CONTENT), - TALER_TESTING_cmd_merchant_lock_product ("lock-product-p2", - merchant_url, - "product-2", - GNUNET_TIME_UNIT_MINUTES, - 2, - MHD_HTTP_NO_CONTENT), - TALER_TESTING_cmd_merchant_lock_product ("lock-product-nx", - merchant_url, - "product-nx", - GNUNET_TIME_UNIT_MINUTES, - 2, - MHD_HTTP_NOT_FOUND), - TALER_TESTING_cmd_merchant_lock_product ("lock-product-too-much", - merchant_url, - "product-2", - GNUNET_TIME_UNIT_MINUTES, - 39, - MHD_HTTP_GONE), - TALER_TESTING_cmd_merchant_delete_product ("delete-product-locked", - merchant_url, - "product-2", - MHD_HTTP_CONFLICT), -#if 1 + TALER_TESTING_cmd_merchant_get_products ( + "get-products-empty", + merchant_url, + MHD_HTTP_OK, + NULL), + TALER_TESTING_cmd_merchant_post_products ( + "post-products-p1", + merchant_url, + "product-1", + "a product", + "EUR:1", + MHD_HTTP_NO_CONTENT), + TALER_TESTING_cmd_merchant_post_products ( + "post-products-p1-idem", + merchant_url, + "product-1", + "a product", + "EUR:1", + MHD_HTTP_NO_CONTENT), + TALER_TESTING_cmd_merchant_post_products ( + "post-products-p1-non-idem", + merchant_url, + "product-1", + "a different product", + "EUR:1", + MHD_HTTP_CONFLICT), + TALER_TESTING_cmd_merchant_get_products ( + "get-products-p1", + merchant_url, + MHD_HTTP_OK, + "post-products-p1", + NULL), + TALER_TESTING_cmd_merchant_get_product ( + "get-product-p1", + merchant_url, + "product-1", + MHD_HTTP_OK, + "post-products-p1"), + TALER_TESTING_cmd_merchant_post_products ( + "post-products-p2", + merchant_url, + "product-2", + "a product", + "EUR:1", + MHD_HTTP_NO_CONTENT), + TALER_TESTING_cmd_merchant_patch_product ( + "patch-products-p2", + merchant_url, + "product-2", + "another product", + json_pack ("{s:s}", "en", "text"), + "kg", + "EUR:1", + "data:image/jpeg;base64,RAWDATA", + json_array (), + 40, + 0, + json_pack ("{s:s}", + "street", + "pstreet"), + GNUNET_TIME_relative_to_timestamp ( + GNUNET_TIME_UNIT_MINUTES), + MHD_HTTP_NO_CONTENT), + TALER_TESTING_cmd_merchant_get_product ( + "get-product-p2", + merchant_url, + "product-2", + MHD_HTTP_OK, + "patch-products-p2"), + TALER_TESTING_cmd_merchant_get_product ( + "get-product-nx", + merchant_url, + "product-nx", + MHD_HTTP_NOT_FOUND, + NULL), + TALER_TESTING_cmd_merchant_patch_product ( + "patch-products-p3-nx", + merchant_url, + "product-3", + "nx updated product", + json_pack ("{s:s}", "en", "text"), + "kg", + "EUR:1", + "data:image/jpeg;base64,RAWDATA", + json_array (), + 40, + 0, + json_pack ("{s:s}", + "street", + "pstreet"), + GNUNET_TIME_relative_to_timestamp ( + GNUNET_TIME_UNIT_MINUTES), + MHD_HTTP_NOT_FOUND), + TALER_TESTING_cmd_merchant_delete_product ( + "get-products-empty", + merchant_url, + "p1", + MHD_HTTP_NOT_FOUND), + TALER_TESTING_cmd_merchant_delete_product ( + "get-products-empty", + merchant_url, + "product-1", + MHD_HTTP_NO_CONTENT), + TALER_TESTING_cmd_merchant_lock_product ( + "lock-product-p2", + merchant_url, + "product-2", + GNUNET_TIME_UNIT_MINUTES, + 2, + MHD_HTTP_NO_CONTENT), + TALER_TESTING_cmd_merchant_lock_product ( + "lock-product-nx", + merchant_url, + "product-nx", + GNUNET_TIME_UNIT_MINUTES, + 2, + MHD_HTTP_NOT_FOUND), + TALER_TESTING_cmd_merchant_lock_product ( + "lock-product-too-much", + merchant_url, + "product-2", + GNUNET_TIME_UNIT_MINUTES, + 39, + MHD_HTTP_GONE), + TALER_TESTING_cmd_merchant_delete_product ( + "delete-product-locked", + merchant_url, + "product-2", + MHD_HTTP_CONFLICT), +#if 0 TALER_TESTING_cmd_batch ("pay", pay), TALER_TESTING_cmd_batch ("double-spending", |