diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-04-25 22:32:36 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-04-25 22:32:36 +0200 |
commit | 46aa711262566b7a8f358cbe684c64ed526a5edb (patch) | |
tree | f4defe802906f061e66ba1ce82247f3c4c8d1f1b /src/testing | |
parent | 23750b7d0622c7080ff8acde2b623568b98a88f4 (diff) | |
download | merchant-46aa711262566b7a8f358cbe684c64ed526a5edb.tar.gz merchant-46aa711262566b7a8f358cbe684c64ed526a5edb.tar.bz2 merchant-46aa711262566b7a8f358cbe684c64ed526a5edb.zip |
misc bugfixes
Diffstat (limited to 'src/testing')
-rw-r--r-- | src/testing/test_merchant_api.c | 4 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_get_product.c | 4 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_patch_product.c | 12 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_post_instances.c | 5 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_post_products.c | 15 |
5 files changed, 25 insertions, 15 deletions
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c index 1e91d4eb..18380845 100644 --- a/src/testing/test_merchant_api.c +++ b/src/testing/test_merchant_api.c @@ -1034,6 +1034,10 @@ run (void *cls, 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), #if 0 TALER_TESTING_cmd_batch ("pay", diff --git a/src/testing/testing_api_cmd_get_product.c b/src/testing/testing_api_cmd_get_product.c index 43d39bbc..8ba63af6 100644 --- a/src/testing/testing_api_cmd_get_product.c +++ b/src/testing/testing_api_cmd_get_product.c @@ -81,7 +81,7 @@ struct GetProductState * applicable taxes. * @param image base64-encoded product image * @param taxes list of taxes paid by the merchant - * @param total_stocked in @a units, -1 to indicate "infinite" (i.e. electronic books), + * @param total_stock in @a units, -1 to indicate "infinite" (i.e. electronic books), * does NOT indicate remaining stocks, to get remaining stocks, * subtract @a total_sold and @a total_lost. Note that this still * does not then say how many of the remaining inventory are locked. @@ -100,7 +100,7 @@ get_product_cb (void *cls, const struct TALER_Amount *price, const json_t *image, const json_t *taxes, - int64_t total_stocked, + int64_t total_stock, uint64_t total_sold, uint64_t total_lost, const json_t *location, diff --git a/src/testing/testing_api_cmd_patch_product.c b/src/testing/testing_api_cmd_patch_product.c index ec4bb4c4..9ddcdceb 100644 --- a/src/testing/testing_api_cmd_patch_product.c +++ b/src/testing/testing_api_cmd_patch_product.c @@ -87,7 +87,7 @@ struct PatchProductState /** * in @e units, -1 to indicate "infinite" (i.e. electronic books) */ - int64_t total_stocked; + int64_t total_stock; /** * in @e units. @@ -172,7 +172,7 @@ patch_product_run (void *cls, &pis->price, pis->image, pis->taxes, - pis->total_stocked, + pis->total_stock, pis->total_lost, pis->address, pis->next_restock, @@ -225,9 +225,9 @@ patch_product_cleanup (void *cls, * applicable taxes. * @param image base64-encoded product image * @param taxes list of taxes paid by the merchant - * @param total_stocked in @a units, -1 to indicate "infinite" (i.e. electronic books) + * @param total_stock in @a units, -1 to indicate "infinite" (i.e. electronic books) * @param total_lost in @a units, must be larger than previous values, and may - * not exceed total_stocked minus total_sold; if it does, the transaction + * not exceed total_stock minus total_sold; if it does, the transaction * will fail with a #MHD_HTTP_CONFLICT HTTP status code * @param address where the product is in stock * @param next_restock when the next restocking is expected to happen, 0 for unknown, @@ -246,7 +246,7 @@ TALER_TESTING_cmd_merchant_patch_product ( const char *price, json_t *image, json_t *taxes, - int64_t total_stocked, + int64_t total_stock, uint64_t total_lost, json_t *address, struct GNUNET_TIME_Absolute next_restock, @@ -266,7 +266,7 @@ TALER_TESTING_cmd_merchant_patch_product ( &pis->price)); pis->image = image; /* ownership taken */ pis->taxes = taxes; /* ownership taken */ - pis->total_stocked = total_stocked; + pis->total_stock = total_stock; pis->total_lost = total_lost; pis->address = address; /* ownership taken */ pis->next_restock = next_restock; { diff --git a/src/testing/testing_api_cmd_post_instances.c b/src/testing/testing_api_cmd_post_instances.c index 71626008..6392420d 100644 --- a/src/testing/testing_api_cmd_post_instances.c +++ b/src/testing/testing_api_cmd_post_instances.c @@ -136,10 +136,13 @@ post_instances_cb (void *cls, } switch (hr->http_status) { - case MHD_HTTP_OK: + case MHD_HTTP_NO_CONTENT: + break; + case MHD_HTTP_CONFLICT: break; // FIXME: add other legitimate states here... default: + GNUNET_break (0); GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unhandled HTTP status.\n"); } diff --git a/src/testing/testing_api_cmd_post_products.c b/src/testing/testing_api_cmd_post_products.c index 8f787bc1..68f68972 100644 --- a/src/testing/testing_api_cmd_post_products.c +++ b/src/testing/testing_api_cmd_post_products.c @@ -87,7 +87,7 @@ struct PostProductsState /** * in @e units, -1 to indicate "infinite" (i.e. electronic books) */ - int64_t total_stocked; + int64_t total_stock; /** * where the product is in stock @@ -131,10 +131,13 @@ post_products_cb (void *cls, } switch (hr->http_status) { - case MHD_HTTP_OK: + case MHD_HTTP_NO_CONTENT: + break; + case MHD_HTTP_CONFLICT: break; // FIXME: add other legitimate states here... default: + GNUNET_break (0); GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unhandled HTTP status.\n"); } @@ -167,7 +170,7 @@ post_products_run (void *cls, &pis->price, pis->image, pis->taxes, - pis->total_stocked, + pis->total_stock, pis->address, pis->next_restock, &post_products_cb, @@ -219,7 +222,7 @@ post_products_cleanup (void *cls, * applicable taxes. * @param image base64-encoded product image * @param taxes list of taxes paid by the merchant - * @param total_stocked in @a units, -1 to indicate "infinite" (i.e. electronic books) + * @param total_stock in @a units, -1 to indicate "infinite" (i.e. electronic books) * @param address where the product is in stock * @param next_restock when the next restocking is expected to happen, 0 for unknown, * #GNUNET_TIME_UNIT_FOREVER_ABS for 'never'. @@ -237,7 +240,7 @@ TALER_TESTING_cmd_merchant_post_products2 ( const char *price, json_t *image, json_t *taxes, - int64_t total_stocked, + int64_t total_stock, json_t *address, struct GNUNET_TIME_Absolute next_restock, unsigned int http_status) @@ -256,7 +259,7 @@ TALER_TESTING_cmd_merchant_post_products2 ( &pis->price)); pis->image = image; /* ownership taken */ pis->taxes = taxes; /* ownership taken */ - pis->total_stocked = total_stocked; + pis->total_stock = total_stock; pis->address = address; /* ownership taken */ pis->next_restock = next_restock; { |