diff options
Diffstat (limited to 'src/backenddb/test_merchantdb.c')
-rw-r--r-- | src/backenddb/test_merchantdb.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/backenddb/test_merchantdb.c b/src/backenddb/test_merchantdb.c index c3e8d71a..27d6212a 100644 --- a/src/backenddb/test_merchantdb.c +++ b/src/backenddb/test_merchantdb.c @@ -1709,19 +1709,21 @@ test_lookup_contract_terms (const struct InstanceData *instance, * * @param instance the instance to delete from. * @param order the order whose contract terms we should delete. + * @param legal_expiration how long we must wait after creating an order to delete it * @param expected_result the result we expect to receive. * @return 0 on success, 1 otherwise. */ static int test_delete_contract_terms (const struct InstanceData *instance, const struct OrderData *order, + struct GNUNET_TIME_Relative legal_expiration, enum GNUNET_DB_QueryStatus expected_result) { TEST_COND_RET_ON_FAIL (expected_result == plugin->delete_contract_terms (plugin->cls, instance->instance.id, order->id, - GNUNET_TIME_UNIT_MONTHS), + legal_expiration), "Delete contract terms failed\n"); return 0; } @@ -2193,13 +2195,20 @@ run_test_orders (struct TestOrders_Closure *cls) TEST_RET_ON_FAIL (test_delete_order (&cls->instance, &cls->orders[0], GNUNET_DB_STATUS_SUCCESS_NO_RESULTS)); + /* Test we can't delete before the legal expiration */ + TEST_RET_ON_FAIL (test_delete_contract_terms (&cls->instance, + &cls->orders[0], + GNUNET_TIME_UNIT_MONTHS, + GNUNET_DB_STATUS_SUCCESS_NO_RESULTS)); /* Test deleting contract terms */ TEST_RET_ON_FAIL (test_delete_contract_terms (&cls->instance, &cls->orders[0], + GNUNET_TIME_UNIT_ZERO, GNUNET_DB_STATUS_SUCCESS_ONE_RESULT)); /* Test we can't delete something that doesn't exist */ TEST_RET_ON_FAIL (test_delete_contract_terms (&cls->instance, &cls->orders[0], + GNUNET_TIME_UNIT_ZERO, GNUNET_DB_STATUS_SUCCESS_NO_RESULTS)); /* Test delete order where we aren't past the deadline, but the order is unclaimed. */ |