diff options
Diffstat (limited to 'src/exchange-lib/testing_api_trait_string.c')
-rw-r--r-- | src/exchange-lib/testing_api_trait_string.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/exchange-lib/testing_api_trait_string.c b/src/exchange-lib/testing_api_trait_string.c index 308c4ea24..94560d344 100644 --- a/src/exchange-lib/testing_api_trait_string.c +++ b/src/exchange-lib/testing_api_trait_string.c @@ -34,6 +34,7 @@ #define TALER_TESTING_TRAIT_CONTRACT_TERMS "contract-terms" #define TALER_TESTING_TRAIT_TRANSFER_SUBJECT "transfer-subject" #define TALER_TESTING_TRAIT_AMOUNT "amount" +#define TALER_TESTING_TRAIT_URL "url" /** * Obtain contract terms from @a cmd. @@ -206,4 +207,49 @@ TALER_TESTING_make_trait_amount } +/** + * Obtain a url from @a cmd. + * + * @param cmd command to extract trait from + * @param index which url is to be picked, in case + * multiple are offered. + * @param amount[out] where to write the url. + * @return #GNUNET_OK on success + */ +int +TALER_TESTING_get_trait_url + (const struct TALER_TESTING_Command *cmd, + unsigned int index, + const char **url) +{ + return cmd->traits (cmd->cls, + (void **) url, + TALER_TESTING_TRAIT_URL, + index); +} + +/** + * Offer url in a trait. + * + * @param index which url is to be picked, in case + * multiple are offered. + * @param url the url to offer + * @return the trait, to be put in the traits array of the command + */ +struct TALER_TESTING_Trait +TALER_TESTING_make_trait_url + (unsigned int index, + const char *url) +{ + struct TALER_TESTING_Trait ret = { + .index = index, + .trait_name = TALER_TESTING_TRAIT_URL, + .ptr = (const void *) url + }; + return ret; +} + + + + /* end of testing_api_trait_string.c */ |