diff options
Diffstat (limited to 'src/testing/testing_api_cmd_post_reserves.c')
-rw-r--r-- | src/testing/testing_api_cmd_post_reserves.c | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/src/testing/testing_api_cmd_post_reserves.c b/src/testing/testing_api_cmd_post_reserves.c index 573d0040..e9bd63a1 100644 --- a/src/testing/testing_api_cmd_post_reserves.c +++ b/src/testing/testing_api_cmd_post_reserves.c @@ -66,6 +66,11 @@ struct PostReservesState * Expected HTTP response code. */ unsigned int http_status; + + /** + * Public key assigned to the reserve + */ + struct TALER_ReservePublicKeyP *reserve_pub; }; /** @@ -111,11 +116,43 @@ post_reserves_cb (void *cls, "Unhandled HTTP status (%d).\n", hr->http_status); } + prs->reserve_pub = GNUNET_memdup (reserve_pub, + sizeof (struct TALER_ReservePublicKeyP)); + GNUNET_assert (NULL != prs->reserve_pub); TALER_TESTING_interpreter_next (prs->is); } /** + * Offers information from the POST /reserves 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 +post_reserves_traits (void *cls, + const void **ret, + const char *trait, + unsigned int index) +{ + struct PostReservesState *prs = cls; + struct TALER_TESTING_Trait traits[] = { + TALER_TESTING_make_trait_reserve_pub (0, prs->reserve_pub), + TALER_TESTING_trait_end (), + }; + + return TALER_TESTING_get_trait (traits, + ret, + trait, + index); +} + + +/** * Run the "POST /reserves" CMD. * * @param cls closure. @@ -160,6 +197,7 @@ post_reserves_cleanup (void *cls, "POST /reserves operation did not complete\n"); TALER_MERCHANT_reserves_post_cancel (prs->prh); } + GNUNET_free (prs->reserve_pub); GNUNET_free (prs); } @@ -198,7 +236,8 @@ TALER_TESTING_cmd_merchant_post_reserves (const char *label, .cls = prs, .label = label, .run = &post_reserves_run, - .cleanup = &post_reserves_cleanup + .cleanup = &post_reserves_cleanup, + .traits = &post_reserves_traits }; return cmd; |