[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-merchant] 14/22: /proposal cb called with response c
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-merchant] 14/22: /proposal cb called with response code == 0. |
Date: |
Sat, 17 Mar 2018 01:58:39 +0100 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository merchant.
commit be0f95411aaecc61a8827ad62ab18bebede378bf
Author: Marcello Stanisci <address@hidden>
AuthorDate: Thu Mar 15 11:43:49 2018 +0100
/proposal cb called with response code == 0.
---
src/lib/merchant_api_proposal.c | 7 ++++++-
src/lib/test_merchant_api_twisted.c | 36 ++++++++++++++++++++++++++++++++++++
src/lib/testing_api_cmd_proposal.c | 15 +++++++++++++--
3 files changed, 55 insertions(+), 3 deletions(-)
diff --git a/src/lib/merchant_api_proposal.c b/src/lib/merchant_api_proposal.c
index 8f4f67f..688e8ce 100644
--- a/src/lib/merchant_api_proposal.c
+++ b/src/lib/merchant_api_proposal.c
@@ -136,7 +136,12 @@ handle_proposal_finished (void *cls,
switch (response_code)
{
case 0:
- break;
+ po->cb (po->cb_cls,
+ response_code,
+ TALER_EC_INVALID_RESPONSE,
+ json,
+ order_id);
+ return;
case MHD_HTTP_OK:
{
if (GNUNET_OK !=
diff --git a/src/lib/test_merchant_api_twisted.c
b/src/lib/test_merchant_api_twisted.c
index 18ac0fe..d1b12cc 100644
--- a/src/lib/test_merchant_api_twisted.c
+++ b/src/lib/test_merchant_api_twisted.c
@@ -335,6 +335,41 @@ run (void *cls,
1, // nresult
10, // start
10), // nrows
+
+ /**** Covering /proposal lib ****/
+
+ /**
+ * Cause the PUT /proposal callback to be called
+ * with a response code == 0. We achieve this by malforming
+ * the response body.
+ */
+
+ TALER_TESTING_cmd_malform_response
+ ("malform-proposal",
+ PROXY_MERCHANT_CONFIG_FILE),
+
+ TALER_TESTING_cmd_proposal
+ ("create-proposal-0",
+ twister_merchant_url,
+ is->ctx,
+ 0,
+ "{\"max_fee\":\
+ {\"currency\":\"EUR\",\
+ \"value\":0,\
+ \"fraction\":50000000},\
+ \"order_id\":\"1\",\
+ \"refund_deadline\":\"\\/Date(0)\\/\",\
+ \"pay_deadline\":\"\\/Date(99999999999)\\/\",\
+ \"amount\":\
+ {\"currency\":\"EUR\",\
+ \"value\":5,\
+ \"fraction\":0},\
+ \"summary\": \"merchant-lib testcase\",\
+ \"products\": [ {\"description\":\"ice cream\",\
+ \"value\":\"{EUR:5}\"} ] }",
+ NULL),
+
+
/**
* End the suite. Fixme: better to have a label for this
* too, as it shows a "(null)" token on logs.
@@ -342,6 +377,7 @@ run (void *cls,
TALER_TESTING_cmd_end ()
};
+
TALER_TESTING_run_with_fakebank (is,
commands,
fakebank_url);
diff --git a/src/lib/testing_api_cmd_proposal.c
b/src/lib/testing_api_cmd_proposal.c
index 3c6c439..f42dfa8 100644
--- a/src/lib/testing_api_cmd_proposal.c
+++ b/src/lib/testing_api_cmd_proposal.c
@@ -262,6 +262,17 @@ proposal_cb (void *cls,
struct ProposalState *ps = cls;
ps->po = NULL;
+
+ if (ps->http_status != http_status)
+ TALER_TESTING_FAIL (ps->is);
+
+ if (0 == ps->http_status)
+ {
+ TALER_LOG_DEBUG ("/proposal, expected 0 status code\n");
+ TALER_TESTING_interpreter_next (ps->is);
+ return;
+ }
+
switch (http_status)
{
case MHD_HTTP_OK:
@@ -386,8 +397,8 @@ proposal_cleanup (void *cls,
ps->plo = NULL;
}
- GNUNET_free ((void *) ps->order_id);
- GNUNET_free ((void *) ps->contract_terms);
+ GNUNET_free_non_null ((void *) ps->order_id);
+ GNUNET_free_non_null ((void *) ps->contract_terms);
GNUNET_free (ps);
}
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [taler-merchant] 04/22: check if twister is installed., (continued)
- [GNUnet-SVN] [taler-merchant] 04/22: check if twister is installed., gnunet, 2018/03/16
- [GNUnet-SVN] [taler-merchant] 01/22: re-enable twisted tests, gnunet, 2018/03/16
- [GNUnet-SVN] [taler-merchant] 08/22: trigger 424, gnunet, 2018/03/16
- [GNUnet-SVN] [taler-merchant] 07/22: enabling twisted command., gnunet, 2018/03/16
- [GNUnet-SVN] [taler-merchant] 19/22: unparsable response for proposal-lookup., gnunet, 2018/03/16
- [GNUnet-SVN] [taler-merchant] 06/22: multicoin check paid., gnunet, 2018/03/16
- [GNUnet-SVN] [taler-merchant] 09/22: trigger 424 confict caused by exchange., gnunet, 2018/03/16
- [GNUnet-SVN] [taler-merchant] 10/22: do not treat 424 Failed Dependency as "unexpected"., gnunet, 2018/03/16
- [GNUnet-SVN] [taler-merchant] 20/22: cause invalid proposal-lookup response., gnunet, 2018/03/16
- [GNUnet-SVN] [taler-merchant] 03/22: comments, gnunet, 2018/03/16
- [GNUnet-SVN] [taler-merchant] 14/22: /proposal cb called with response code == 0.,
gnunet <=
- [GNUnet-SVN] [taler-merchant] 22/22: fulfillment URL mandatory., gnunet, 2018/03/16
- [GNUnet-SVN] [taler-merchant] 11/22: typo, gnunet, 2018/03/16
- [GNUnet-SVN] [taler-merchant] 05/22: fix multi-coin payment., gnunet, 2018/03/16
- [GNUnet-SVN] [taler-merchant] 21/22: re-enabling 402 Failed Dependency from /track/transaction., gnunet, 2018/03/16
- [GNUnet-SVN] [taler-merchant] 15/22: test against invalid proposal., gnunet, 2018/03/16
- [GNUnet-SVN] [taler-merchant] 02/22: preparing to HTTP response body modification., gnunet, 2018/03/16
- [GNUnet-SVN] [taler-merchant] 13/22: malforming /history response body, and avoid extracting error codes from NULL responses., gnunet, 2018/03/16
- [GNUnet-SVN] [taler-merchant] 17/22: trigger 404 @ /proposal, gnunet, 2018/03/16
- [GNUnet-SVN] [taler-merchant] 16/22: be more gentle with unexpected response codes., gnunet, 2018/03/16
- [GNUnet-SVN] [taler-merchant] 18/22: proposal-lookup 404 Not Found., gnunet, 2018/03/16