diff options
author | Marcello Stanisci <stanisci.m@gmail.com> | 2018-03-23 12:55:21 +0100 |
---|---|---|
committer | Marcello Stanisci <stanisci.m@gmail.com> | 2018-03-23 12:55:21 +0100 |
commit | 68436afb0324ab62ad4ccce04ca5eee07a19e498 (patch) | |
tree | 05d01ac821290eb736a15c11f79538a38c8c4ceb | |
parent | ff6fba5d6336ae0002b47cebbf56c5f9f3d0a2f9 (diff) | |
download | merchant-68436afb0324ab62ad4ccce04ca5eee07a19e498.tar.gz merchant-68436afb0324ab62ad4ccce04ca5eee07a19e498.tar.bz2 merchant-68436afb0324ab62ad4ccce04ca5eee07a19e498.zip |
putting tip-pickup under test.
-rw-r--r-- | src/lib/test_merchant_api_new.c | 14 | ||||
-rw-r--r-- | src/lib/testing_api_cmd_tip.c | 35 |
2 files changed, 47 insertions, 2 deletions
diff --git a/src/lib/test_merchant_api_new.c b/src/lib/test_merchant_api_new.c index 2b8e75df..cd05677b 100644 --- a/src/lib/test_merchant_api_new.c +++ b/src/lib/test_merchant_api_new.c @@ -48,6 +48,8 @@ */ #define EXCHANGE_URL "http://localhost:8081/" +static const char *pickup_amounts_1[] = {"EUR:5", NULL}; + /** * URL of the fakebank. Obtained from CONFIG_FILE's * "exchange-wire-test:BANK_URI" option. @@ -511,6 +513,15 @@ run (void *cls, "EUR:0.0", // picked "EUR:10.02", // auth "EUR:20.04"),// ava + + TALER_TESTING_cmd_tip_pickup ("pickup-tip-1", + merchant_url, + is->ctx, + MHD_HTTP_OK, + "authorize-tip-1", + pickup_amounts_1, + is->exchange), + /* Will fail here until all new * transfers have not been checked. I.e., * there is now a 20.04 euro "pending" transfer. */ @@ -737,7 +748,8 @@ main (int argc, ret = TALER_TESTING_setup_with_exchange (&run, NULL, CONFIG_FILE); - GNUNET_OS_process_kill (merchantd, SIGKILL); + + GNUNET_OS_process_kill (merchantd, SIGTERM); GNUNET_OS_process_wait (merchantd); GNUNET_OS_process_destroy (merchantd); GNUNET_free (merchant_url); diff --git a/src/lib/testing_api_cmd_tip.c b/src/lib/testing_api_cmd_tip.c index 80722ba0..eb87034c 100644 --- a/src/lib/testing_api_cmd_tip.c +++ b/src/lib/testing_api_cmd_tip.c @@ -194,6 +194,37 @@ tip_authorize_cb (void *cls, TALER_TESTING_interpreter_next (tas->is); } +/** + * Extract information from a command that is useful for other + * commands. + * + * @param cls closure + * @param ret[out] result (could be anything) + * @param trait name of the trait + * @param selector more detailed information about which object + * to return in case there were multiple generated + * by the command + * @return #GNUNET_OK on success + */ +static int +tip_authorize_traits (void *cls, + void **ret, + const char *trait, + unsigned int index) +{ + struct TipAuthorizeState *tas = cls; + + struct TALER_TESTING_Trait traits[] = { + TALER_TESTING_make_trait_tip_id (0, &tas->tip_id), + TALER_TESTING_trait_end (), + }; + + return TALER_TESTING_get_trait (traits, + ret, + trait, + index); + return GNUNET_SYSERR; +} /** * Runs the command. Note that upon return, the interpreter @@ -281,6 +312,7 @@ TALER_TESTING_cmd_tip_authorize (const char *label, cmd.cls = tas; cmd.run = &tip_authorize_run; cmd.cleanup = &tip_authorize_cleanup; + cmd.traits = &tip_authorize_traits; return cmd; } @@ -593,7 +625,6 @@ pickup_cb (void *cls, if (num_reserve_sigs != tps->num_coins) TALER_TESTING_FAIL (tps->is); - /* pickup successful, now withdraw! */ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Obtained %u signatures for withdrawal" @@ -633,6 +664,7 @@ tip_pickup_run (void *cls, const struct TALER_TESTING_Command *cmd, struct TALER_TESTING_Interpreter *is) { + struct TipPickupState *tps = cls; unsigned int num_planchets; const struct TALER_TESTING_Command *replay_cmd; @@ -801,6 +833,7 @@ TALER_TESTING_cmd_tip_pickup tps->authorize_reference = authorize_reference; tps->amounts = amounts; tps->exchange = exchange; + tps->http_status = http_status; cmd.cls = tps; cmd.label = label; |