diff options
author | Marcello Stanisci <stanisci.m@gmail.com> | 2018-02-14 12:46:01 +0100 |
---|---|---|
committer | Marcello Stanisci <stanisci.m@gmail.com> | 2018-02-14 12:46:01 +0100 |
commit | 5b1e17617faf356f0d85e7e6bf2b188483bcf351 (patch) | |
tree | 0cc53564805d03d47a7a6368ecc0cd5343333853 | |
parent | fe6960cce854cd4c665a27c4368e4397c8e7bcfb (diff) |
offer url trait
-rw-r--r-- | src/exchange-lib/testing_api_cmd_exec_wirewatch.c | 6 | ||||
-rw-r--r-- | src/exchange-lib/testing_api_loop.c | 2 | ||||
-rw-r--r-- | src/exchange-lib/testing_api_trait_string.c | 46 | ||||
-rw-r--r-- | src/include/taler_testing_lib.h | 29 |
4 files changed, 81 insertions, 2 deletions
diff --git a/src/exchange-lib/testing_api_cmd_exec_wirewatch.c b/src/exchange-lib/testing_api_cmd_exec_wirewatch.c index 107ac55a7..1ff466f56 100644 --- a/src/exchange-lib/testing_api_cmd_exec_wirewatch.c +++ b/src/exchange-lib/testing_api_cmd_exec_wirewatch.c @@ -89,7 +89,7 @@ wirewatch_run (void *cls, */ static void wirewatch_cleanup (void *cls, - const struct TALER_TESTING_Command *cmd) + const struct TALER_TESTING_Command *cmd) { struct WirewatchState *ws = cls; @@ -141,6 +141,10 @@ wirewatch_traits (void *cls, /** * Execute taler-exchange-wirewatch process. * + * @param label command label + * @param config_filename configuration filename + * + * @return the command */ struct TALER_TESTING_Command TALER_TESTING_cmd_exec_wirewatch (const char *label, diff --git a/src/exchange-lib/testing_api_loop.c b/src/exchange-lib/testing_api_loop.c index f22c99d86..c4b6031bb 100644 --- a/src/exchange-lib/testing_api_loop.c +++ b/src/exchange-lib/testing_api_loop.c @@ -537,7 +537,6 @@ main_wrapper (void *cls) main_ctx)) ); GNUNET_free (exchange_url); GNUNET_CONFIGURATION_destroy (cfg); - } @@ -586,6 +585,7 @@ TALER_TESTING_setup (TALER_TESTING_Main main_cb, GNUNET_assert (NULL != sigpipe); shc_chld = GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD, &sighandler_child_death); + /* Blocking */ GNUNET_SCHEDULER_run (&main_wrapper, &main_ctx); GNUNET_SIGNAL_handler_uninstall (shc_chld); 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 */ diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h index de671c9f7..a78f7f3f5 100644 --- a/src/include/taler_testing_lib.h +++ b/src/include/taler_testing_lib.h @@ -1251,4 +1251,33 @@ TALER_TESTING_get_trait_amount unsigned int index, const char **amount); + +/** + * 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); + +/** + * 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); + #endif |