diff options
author | ng0 <ng0@n0.is> | 2019-04-10 20:49:59 +0000 |
---|---|---|
committer | ng0 <ng0@n0.is> | 2019-04-10 20:51:36 +0000 |
commit | 71acaff203586a956c71f0e90317d5fff0a50e14 (patch) | |
tree | fa2abb2a5b48894783da859e74c1966772be3ddf /src/bank-lib/test_bank_api_new.c | |
parent | 2699155b81f8db564e27610896eb2af0c3e88c6d (diff) | |
parent | a73e1dd4198bd7fe83e6e00ee01fe5a83bbaa41d (diff) | |
download | exchange-71acaff203586a956c71f0e90317d5fff0a50e14.tar.gz exchange-71acaff203586a956c71f0e90317d5fff0a50e14.tar.bz2 exchange-71acaff203586a956c71f0e90317d5fff0a50e14.zip |
Merge branch 'master' of git.taler.net:exchange
Diffstat (limited to 'src/bank-lib/test_bank_api_new.c')
-rw-r--r-- | src/bank-lib/test_bank_api_new.c | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/src/bank-lib/test_bank_api_new.c b/src/bank-lib/test_bank_api_new.c index 38ac537f7..5031a3089 100644 --- a/src/bank-lib/test_bank_api_new.c +++ b/src/bank-lib/test_bank_api_new.c @@ -40,6 +40,29 @@ #define CONFIG_FILE "bank.conf" /** + * Adds to the current time. + * + * @param relative number of _seconds_ to add to the current time. + * @return a new absolute time, modified according to @e relative. + */ +#define NOWPLUSSECS(secs) \ + GNUNET_TIME_absolute_add \ + (now, \ + GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, \ + secs)) + +/** + * Subtracts from the current time. + * + * @param relative number of _seconds_ to add to the current time. + * @return a new absolute time, modified according to @e relative. + */ +#define NOWMINUSSECS(secs) \ + GNUNET_TIME_absolute_subtract \ + (now, \ + GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, \ + secs)) +/** * Bank process. */ struct GNUNET_OS_Process *bankd; @@ -61,11 +84,12 @@ run (void *cls, { extern struct TALER_BANK_AuthenticationData AUTHS[]; + struct GNUNET_TIME_Absolute now; GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Bank serves at `%s'\n", bank_url); - + now = GNUNET_TIME_absolute_get (); struct TALER_TESTING_Command commands[] = { TALER_TESTING_cmd_bank_history ("history-0", @@ -76,6 +100,15 @@ run (void *cls, NULL, /* start */ 5), + TALER_TESTING_cmd_bank_history_range_with_dates + ("history-0-range", + bank_url, + EXCHANGE_ACCOUNT_NUMBER, + TALER_BANK_DIRECTION_BOTH, + GNUNET_NO, + NOWMINUSSECS (5), + NOWPLUSSECS (5)), + TALER_TESTING_cmd_fakebank_transfer_with_subject ("deposit-1", "KUDOS:5.01", @@ -131,6 +164,18 @@ run (void *cls, "deposit-1", 5), + /** + * Just check that the two transactions show up. + */ + TALER_TESTING_cmd_bank_history_range_with_dates + ("history-2-range", + bank_url, + EXCHANGE_ACCOUNT_NUMBER, + TALER_BANK_DIRECTION_BOTH, + GNUNET_NO, + NOWMINUSSECS (5), + NOWPLUSSECS (5)), + TALER_TESTING_cmd_bank_reject ("reject-1", bank_url, "deposit-1"), |