diff options
Diffstat (limited to 'src/testing')
| -rw-r--r-- | src/testing/testing_api_cmd_batch_withdraw.c | 15 | ||||
| -rw-r--r-- | src/testing/testing_api_cmd_oauth.c | 36 | ||||
| -rw-r--r-- | src/testing/testing_api_cmd_withdraw.c | 15 | 
3 files changed, 42 insertions, 24 deletions
| diff --git a/src/testing/testing_api_cmd_batch_withdraw.c b/src/testing/testing_api_cmd_batch_withdraw.c index e0b8285a..9283f032 100644 --- a/src/testing/testing_api_cmd_batch_withdraw.c +++ b/src/testing/testing_api_cmd_batch_withdraw.c @@ -321,12 +321,15 @@ batch_withdraw_run (void *cls,      wci->ps = &cs->ps;      wci->ach = cs->h_age_commitment;    } -  ws->wsh = TALER_EXCHANGE_batch_withdraw (exchange, -                                           rp, -                                           wcis, -                                           ws->num_coins, -                                           &reserve_batch_withdraw_cb, -                                           ws); +  ws->wsh = TALER_EXCHANGE_batch_withdraw ( +    TALER_TESTING_interpreter_get_context (is), +    TALER_TESTING_get_exchange_url (is), +    TALER_TESTING_get_keys (is), +    rp, +    wcis, +    ws->num_coins, +    &reserve_batch_withdraw_cb, +    ws);    if (NULL == ws->wsh)    {      GNUNET_break (0); diff --git a/src/testing/testing_api_cmd_oauth.c b/src/testing/testing_api_cmd_oauth.c index 0bcf2f68..fcf7e843 100644 --- a/src/testing/testing_api_cmd_oauth.c +++ b/src/testing/testing_api_cmd_oauth.c @@ -40,6 +40,11 @@ struct OAuthState    struct MHD_Daemon *mhd;    /** +   * Birthdate that the oauth server should return in a response, may be NULL +   */ +  const char *birthdate; + +  /**     * Port to listen on.     */    uint16_t port; @@ -172,28 +177,33 @@ handler_cb (void *cls,              void **con_cls)  {    struct RequestCtx *rc = *con_cls; +  struct OAuthState *oas = cls;    unsigned int hc;    json_t *body; -  (void) cls;    (void) version;    if (0 == strcasecmp (method,                         MHD_HTTP_METHOD_GET))    { +    json_t *data = +      GNUNET_JSON_PACK ( +        GNUNET_JSON_pack_string ("id", +                                 "XXXID12345678"), +        GNUNET_JSON_pack_string ("first_name", +                                 "Bob"), +        GNUNET_JSON_pack_string ("last_name", +                                 "Builder")); +    if (NULL != oas->birthdate) +      json_object_set_new (data, +                           "birthdate", +                           json_string_nocheck (oas->birthdate)); +      body = GNUNET_JSON_PACK (        GNUNET_JSON_pack_string (          "status",          "success"),        GNUNET_JSON_pack_object_steal ( -        "data", -        GNUNET_JSON_PACK ( -          GNUNET_JSON_pack_string ("id", -                                   "XXXID12345678"), -          GNUNET_JSON_pack_string ("first_name", -                                   "Bob"), -          GNUNET_JSON_pack_string ("last_name", -                                   "Builder") -          ))); +        "data", data));      return TALER_MHD_reply_json_steal (connection,                                         body,                                         MHD_HTTP_OK); @@ -368,13 +378,15 @@ oauth_cleanup (void *cls,  struct TALER_TESTING_Command -TALER_TESTING_cmd_oauth (const char *label, -                         uint16_t port) +TALER_TESTING_cmd_oauth_with_birthdate (const char *label, +                                        const char *birthdate, +                                        uint16_t port)  {    struct OAuthState *oas;    oas = GNUNET_new (struct OAuthState);    oas->port = port; +  oas->birthdate = birthdate;    {      struct TALER_TESTING_Command cmd = {        .cls = oas, diff --git a/src/testing/testing_api_cmd_withdraw.c b/src/testing/testing_api_cmd_withdraw.c index 8188eeae..a6315f91 100644 --- a/src/testing/testing_api_cmd_withdraw.c +++ b/src/testing/testing_api_cmd_withdraw.c @@ -410,7 +410,7 @@ withdraw_run (void *cls,    if (NULL == ws->pk)    { -    dpk = TALER_TESTING_find_pk (TALER_EXCHANGE_get_keys (exchange), +    dpk = TALER_TESTING_find_pk (TALER_TESTING_get_keys (is),                                   &ws->amount,                                   ws->age > 0);      if (NULL == dpk) @@ -443,11 +443,14 @@ withdraw_run (void *cls,        .ps = &ws->ps,        .ach = ws->h_age_commitment      }; -    ws->wsh = TALER_EXCHANGE_withdraw (exchange, -                                       rp, -                                       &wci, -                                       &reserve_withdraw_cb, -                                       ws); +    ws->wsh = TALER_EXCHANGE_withdraw ( +      TALER_TESTING_interpreter_get_context (is), +      TALER_TESTING_get_exchange_url (is), +      TALER_TESTING_get_keys (is), +      rp, +      &wci, +      &reserve_withdraw_cb, +      ws);    }    if (NULL == ws->wsh)    { | 
