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_patch_product.c | 40 ++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'src/testing/testing_api_cmd_patch_product.c') diff --git a/src/testing/testing_api_cmd_patch_product.c b/src/testing/testing_api_cmd_patch_product.c index 9ddcdceb..26088431 100644 --- a/src/testing/testing_api_cmd_patch_product.c +++ b/src/testing/testing_api_cmd_patch_product.c @@ -182,6 +182,43 @@ patch_product_run (void *cls, } +/** + * Offers information from the PATCH /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 +patch_product_traits (void *cls, + const void **ret, + const char *trait, + unsigned int index) +{ + struct PatchProductState *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 "GET product" CMD, and possibly * cancel a pending operation thereof. @@ -274,7 +311,8 @@ TALER_TESTING_cmd_merchant_patch_product ( .cls = pis, .label = label, .run = &patch_product_run, - .cleanup = &patch_product_cleanup + .cleanup = &patch_product_cleanup, + .traits = &patch_product_traits }; return cmd; -- cgit v1.2.3