aboutsummaryrefslogtreecommitdiff
path: root/src/testing/testing_api_trait_json.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-06-23 10:30:37 +0200
committerChristian Grothoff <christian@grothoff.org>2020-06-23 10:30:37 +0200
commitb3411dc65c1b366989f97fd82cfaa0947624b6b6 (patch)
tree7d0acee5fe6d4cb5b6e646b14f2fcec63358ad5f /src/testing/testing_api_trait_json.c
parent48d4690fbd0576e900332dcbfb285d0537091abf (diff)
parent29d163d58c1d7769184d8827e19fc401ee937b3b (diff)
Merge branch 'protocolv8' of git+ssh://git.taler.net/exchange into protocolv8
Diffstat (limited to 'src/testing/testing_api_trait_json.c')
-rw-r--r--src/testing/testing_api_trait_json.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/testing/testing_api_trait_json.c b/src/testing/testing_api_trait_json.c
index cbddad53..e12f1e9a 100644
--- a/src/testing/testing_api_trait_json.c
+++ b/src/testing/testing_api_trait_json.c
@@ -30,6 +30,7 @@
#define TALER_TESTING_TRAIT_WIRE_DETAILS "wire-details"
#define TALER_TESTING_TRAIT_EXCHANGE_KEYS "exchange-keys"
+#define TALER_TESTING_TRAIT_JSON "json"
/**
* Obtain serialized exchange keys from @a cmd.
@@ -120,4 +121,45 @@ TALER_TESTING_make_trait_wire_details
}
+/**
+ * Obtain json from @a cmd.
+ *
+ * @param cmd command to extract the json from.
+ * @param index index number associate with the json on offer.
+ * @param[out] json where to write the json.
+ * @return #GNUNET_OK on success.
+ */
+int
+TALER_TESTING_get_trait_json (const struct TALER_TESTING_Command *cmd,
+ unsigned int index,
+ const json_t **json)
+{
+ return cmd->traits (cmd->cls,
+ (const void **) json,
+ TALER_TESTING_TRAIT_JSON,
+ index);
+}
+
+
+/**
+ * Offer json in a trait.
+ *
+ * @param index index number associate with the json
+ * on offer.
+ * @param json json to offer.
+ * @return the trait.
+ */
+struct TALER_TESTING_Trait
+TALER_TESTING_make_trait_json (unsigned int index,
+ const json_t *json)
+{
+ struct TALER_TESTING_Trait ret = {
+ .index = index,
+ .trait_name = TALER_TESTING_TRAIT_JSON,
+ .ptr = (const json_t *) json
+ };
+ return ret;
+}
+
+
/* end of testing_api_trait_json.c */