diff options
author | Jonathan Buchanan <jonathan.russ.buchanan@gmail.com> | 2020-06-22 16:34:21 -0400 |
---|---|---|
committer | Jonathan Buchanan <jonathan.russ.buchanan@gmail.com> | 2020-06-22 16:34:21 -0400 |
commit | cac09657404fa6075fad0e09b6a855b4110f792d (patch) | |
tree | 8a62808678143e4aa0fee6ef858364a6a0a67aaf /src/testing/testing_api_cmd_post_products.c | |
parent | d83304e2a3af18480e3c83077c54a1b532904d2b (diff) | |
download | merchant-cac09657404fa6075fad0e09b6a855b4110f792d.tar.gz merchant-cac09657404fa6075fad0e09b6a855b4110f792d.tar.bz2 merchant-cac09657404fa6075fad0e09b6a855b4110f792d.zip |
more checks for GET /private/products/
Diffstat (limited to 'src/testing/testing_api_cmd_post_products.c')
-rw-r--r-- | src/testing/testing_api_cmd_post_products.c | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/src/testing/testing_api_cmd_post_products.c b/src/testing/testing_api_cmd_post_products.c index 68f68972..9e78ecbc 100644 --- a/src/testing/testing_api_cmd_post_products.c +++ b/src/testing/testing_api_cmd_post_products.c @@ -180,6 +180,43 @@ post_products_run (void *cls, /** + * Offers information from the POST /products CMD state to other + * commands. + * + * @param cls closure + * @param ret[out] result (could be anything) + * @param trait name of the trait + * @param index index number of the object to extract. + * @return #GNUNET_OK on success + */ +static int +post_products_traits (void *cls, + const void **ret, + const char *trait, + unsigned int index) +{ + struct PostProductsState *pps = cls; + struct TALER_TESTING_Trait traits[] = { + TALER_TESTING_make_trait_string (0, pps->description), + TALER_TESTING_make_trait_json (0, pps->description_i18n), + TALER_TESTING_make_trait_string (1, pps->unit), + TALER_TESTING_make_trait_amount_obj (0, &pps->price), + TALER_TESTING_make_trait_json (1, pps->image), + TALER_TESTING_make_trait_json (2, pps->taxes), + TALER_TESTING_make_trait_int64 (0, &pps->total_stock), + TALER_TESTING_make_trait_json (3, pps->address), + TALER_TESTING_make_trait_absolute_time (0, &pps->next_restock), + TALER_TESTING_trait_end (), + }; + + return TALER_TESTING_get_trait (traits, + ret, + trait, + index); +} + + +/** * Free the state of a "POST product" CMD, and possibly * cancel a pending operation thereof. * @@ -267,7 +304,8 @@ TALER_TESTING_cmd_merchant_post_products2 ( .cls = pis, .label = label, .run = &post_products_run, - .cleanup = &post_products_cleanup + .cleanup = &post_products_cleanup, + .traits = &post_products_traits }; return cmd; |