diff options
author | Marcello Stanisci <marcello.stanisci@inria.fr> | 2017-04-18 13:42:34 +0200 |
---|---|---|
committer | Marcello Stanisci <marcello.stanisci@inria.fr> | 2017-04-18 13:42:34 +0200 |
commit | c5cad65c87b7e41f2549c6ba83be6714f290e0dc (patch) | |
tree | 7e10cdd797d85d21969f08b311484fd39206d859 /src/backenddb/test_merchantdb.c | |
parent | b783ce987fd5543532d61d9fbd483af9394ddc30 (diff) | |
download | merchant-c5cad65c87b7e41f2549c6ba83be6714f290e0dc.tar.gz merchant-c5cad65c87b7e41f2549c6ba83be6714f290e0dc.tar.bz2 merchant-c5cad65c87b7e41f2549c6ba83be6714f290e0dc.zip |
adding db method to query proposal data "in the future"
Diffstat (limited to 'src/backenddb/test_merchantdb.c')
-rw-r--r-- | src/backenddb/test_merchantdb.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/backenddb/test_merchantdb.c b/src/backenddb/test_merchantdb.c index 040fab57..3b95f278 100644 --- a/src/backenddb/test_merchantdb.c +++ b/src/backenddb/test_merchantdb.c @@ -71,6 +71,12 @@ static struct GNUNET_HashCode h_wire; const char *order_id; /** + * Transaction ID used to test the db query + * `find_proposal_data_by_date_and_range_future` + */ +const char *order_id_future; + +/** * Proposal's hash */ struct GNUNET_HashCode h_proposal_data; @@ -326,10 +332,11 @@ run (void *cls) RND_BLK (&h_wire); RND_BLK (&h_proposal_data); order_id = "test_ID"; + order_id_future = "test_ID_future"; RND_BLK (&signkey_pub); RND_BLK (&merchant_pub); RND_BLK (&wtid); - timestamp = GNUNET_TIME_absolute_get(); + timestamp = GNUNET_TIME_absolute_get (); GNUNET_TIME_round_abs (×tamp); delta = GNUNET_TIME_UNIT_MINUTES; fake_now = GNUNET_TIME_absolute_add (timestamp, delta); @@ -387,6 +394,25 @@ run (void *cls) GNUNET_NO, pd_cb, NULL)); + timestamp = GNUNET_TIME_absolute_get (); + GNUNET_TIME_round_abs (×tamp); + + FAILIF (GNUNET_OK != + plugin->insert_proposal_data (plugin->cls, + order_id_future, + &merchant_pub, + timestamp, + proposal_data)); + + FAILIF (1 != + plugin->find_proposal_data_by_date_and_range (plugin->cls, + fake_now, + &merchant_pub, + 0, + 5, + GNUNET_YES, + pd_cb, + NULL)); FAILIF (1 != plugin->find_proposal_data_by_date (plugin->cls, |