summaryrefslogtreecommitdiff
path: root/src/testing/testing_api_cmd_patch_product.c
diff options
context:
space:
mode:
authorJonathan Buchanan <jonathan.russ.buchanan@gmail.com>2020-06-22 16:34:21 -0400
committerJonathan Buchanan <jonathan.russ.buchanan@gmail.com>2020-06-22 16:34:21 -0400
commitcac09657404fa6075fad0e09b6a855b4110f792d (patch)
tree8a62808678143e4aa0fee6ef858364a6a0a67aaf /src/testing/testing_api_cmd_patch_product.c
parentd83304e2a3af18480e3c83077c54a1b532904d2b (diff)
downloadmerchant-cac09657404fa6075fad0e09b6a855b4110f792d.tar.gz
merchant-cac09657404fa6075fad0e09b6a855b4110f792d.tar.bz2
merchant-cac09657404fa6075fad0e09b6a855b4110f792d.zip
more checks for GET /private/products/
Diffstat (limited to 'src/testing/testing_api_cmd_patch_product.c')
-rw-r--r--src/testing/testing_api_cmd_patch_product.c40
1 files changed, 39 insertions, 1 deletions
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
@@ -183,6 +183,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;