[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] branch master updated: fix/test legal expiration for de
From: |
gnunet |
Subject: |
[taler-merchant] branch master updated: fix/test legal expiration for deleting orders |
Date: |
Wed, 05 Aug 2020 21:50:14 +0200 |
This is an automated email from the git hooks/post-receive script.
jonathan-buchanan pushed a commit to branch master
in repository merchant.
The following commit(s) were added to refs/heads/master by this push:
new 36e616c fix/test legal expiration for deleting orders
36e616c is described below
commit 36e616c4d63e1e945f75b3f0d80fd4d44b678f7e
Author: Jonathan Buchanan <jonathan.russ.buchanan@gmail.com>
AuthorDate: Wed Aug 5 15:50:03 2020 -0400
fix/test legal expiration for deleting orders
---
src/backenddb/plugin_merchantdb_postgres.c | 2 +-
src/backenddb/test_merchantdb.c | 11 ++++++++++-
src/testing/test_merchant_api.c | 4 ++--
3 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/backenddb/plugin_merchantdb_postgres.c
b/src/backenddb/plugin_merchantdb_postgres.c
index dd8f00d..41e4ff3 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -7171,7 +7171,7 @@ libtaler_plugin_merchantdb_postgres_init (void *cls)
" WHERE merchant_id=$1)"
" AND ( ( (pay_deadline < $4) AND"
" (NOT paid) ) OR"
- " (creation_time + $3 > $4) )",
+ " (creation_time + $3 < $4) )",
4),
/* for postgres_lookup_deposits() */
GNUNET_PQ_make_prepare ("lookup_deposits",
diff --git a/src/backenddb/test_merchantdb.c b/src/backenddb/test_merchantdb.c
index c3e8d71..27d6212 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. */
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c
index b4e06ed..ead0ba7 100644
--- a/src/testing/test_merchant_api.c
+++ b/src/testing/test_merchant_api.c
@@ -560,10 +560,10 @@ run (void *cls,
"product-3/3",
"lock-product-p3",
NULL),
- TALER_TESTING_cmd_merchant_delete_order ("delete-order-1",
+ TALER_TESTING_cmd_merchant_delete_order ("delete-order-paid",
merchant_url,
"1",
- MHD_HTTP_NO_CONTENT),
+ MHD_HTTP_CONFLICT),
TALER_TESTING_cmd_merchant_post_orders ("create-proposal-no-id",
merchant_url,
MHD_HTTP_OK,
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-merchant] branch master updated: fix/test legal expiration for deleting orders,
gnunet <=