[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] branch master updated: -expand p2p test to cover purse-
From: |
gnunet |
Subject: |
[taler-exchange] branch master updated: -expand p2p test to cover purse-with-deposit-merge sequence |
Date: |
Sat, 23 Apr 2022 19:32:10 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository exchange.
The following commit(s) were added to refs/heads/master by this push:
new e270bc32 -expand p2p test to cover purse-with-deposit-merge sequence
e270bc32 is described below
commit e270bc32cc94f251a9a953816e8c040a3a7bf3e1
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sat Apr 23 19:32:07 2022 +0200
-expand p2p test to cover purse-with-deposit-merge sequence
---
src/include/taler_testing_lib.h | 2 --
src/testing/test_exchange_p2p.c | 27 +++++++++++++++-------
src/testing/testing_api_cmd_purse_create_deposit.c | 13 +++++++----
3 files changed, 28 insertions(+), 14 deletions(-)
diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h
index 30d0f098..3d7ba372 100644
--- a/src/include/taler_testing_lib.h
+++ b/src/include/taler_testing_lib.h
@@ -2366,7 +2366,6 @@ TALER_TESTING_cmd_oauth (const char *label,
*
* @param label command label
* @param expected_http_status what HTTP status do we expect to get returned
from the exchange
- * @param target_amount amount for the purse to be full, without fees
* @param contract_terms contract, JSON string
* @param upload_contract should we upload the contract
* @param purse_expiration how long until the purse expires
@@ -2377,7 +2376,6 @@ struct TALER_TESTING_Command
TALER_TESTING_cmd_purse_create_with_deposit (
const char *label,
unsigned int expected_http_status,
- const char *target_amount,
const char *contract_terms,
bool upload_contract,
struct GNUNET_TIME_Relative purse_expiration,
diff --git a/src/testing/test_exchange_p2p.c b/src/testing/test_exchange_p2p.c
index f1a7f655..930ff2be 100644
--- a/src/testing/test_exchange_p2p.c
+++ b/src/testing/test_exchange_p2p.c
@@ -151,14 +151,25 @@ run (void *cls,
/**
* Spend the coin.
*/
- TALER_TESTING_cmd_deposit ("deposit-simple",
- "withdraw-coin-1",
- 0,
- bc.user42_payto,
- "{\"items\":[{\"name\":\"ice
cream\",\"value\":1}]}",
- GNUNET_TIME_UNIT_ZERO,
- "EUR:5",
- MHD_HTTP_OK),
+ TALER_TESTING_cmd_purse_create_with_deposit (
+ "purse-with-deposit",
+ MHD_HTTP_OK,
+ "{\"amount\":\"EUR:1\",\"summary\":\"ice cream\"}",
+ true, /* upload contract */
+ GNUNET_TIME_UNIT_MINUTES, /* expiration */
+ "withdraw-coin-1",
+ "EUR:1", /* FIXME: check amount vs. fees! */
+ NULL),
+ TALER_TESTING_cmd_contract_get (
+ "purse-get-contract",
+ MHD_HTTP_OK,
+ "purse-with-deposit"),
+ TALER_TESTING_cmd_purse_merge (
+ "purse-merge-into-reserve",
+ MHD_HTTP_OK,
+ "purse-get-contract",
+ "create-reserve-1"),
+ // FIXME: check reserve history!
TALER_TESTING_cmd_end ()
};
diff --git a/src/testing/testing_api_cmd_purse_create_deposit.c
b/src/testing/testing_api_cmd_purse_create_deposit.c
index af7ed3f5..13b2dffa 100644
--- a/src/testing/testing_api_cmd_purse_create_deposit.c
+++ b/src/testing/testing_api_cmd_purse_create_deposit.c
@@ -355,13 +355,13 @@ struct TALER_TESTING_Command
TALER_TESTING_cmd_purse_create_with_deposit (
const char *label,
unsigned int expected_http_status,
- const char *target_amount,
const char *contract_terms,
bool upload_contract,
struct GNUNET_TIME_Relative purse_expiration,
...)
{
struct PurseCreateDepositState *ds;
+ struct GNUNET_TIME_Timestamp pay_deadline;
ds = GNUNET_new (struct PurseCreateDepositState);
ds->rel_expiration = purse_expiration;
@@ -378,6 +378,14 @@ TALER_TESTING_cmd_purse_create_with_deposit (
label);
GNUNET_assert (0);
}
+ pay_deadline =
+ GNUNET_TIME_absolute_to_timestamp (
+ GNUNET_TIME_relative_to_absolute (purse_expiration));
+ GNUNET_assert (0 ==
+ json_object_set_new (
+ ds->contract_terms,
+ "pay_deadline",
+ GNUNET_JSON_from_timestamp (pay_deadline)));
{
va_list ap;
unsigned int i;
@@ -410,9 +418,6 @@ TALER_TESTING_cmd_purse_create_with_deposit (
}
va_end (ap);
}
- GNUNET_assert (GNUNET_OK ==
- TALER_string_to_amount (target_amount,
- &ds->target_amount));
{
struct TALER_TESTING_Command cmd = {
.cls = ds,
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-exchange] branch master updated: -expand p2p test to cover purse-with-deposit-merge sequence,
gnunet <=