From cac09657404fa6075fad0e09b6a855b4110f792d Mon Sep 17 00:00:00 2001 From: Jonathan Buchanan Date: Mon, 22 Jun 2020 16:34:21 -0400 Subject: more checks for GET /private/products/ --- src/testing/testing_api_cmd_post_products.c | 40 ++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'src/testing/testing_api_cmd_post_products.c') 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 @@ -179,6 +179,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; -- cgit v1.2.3