[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-merchant] 18/22: proposal-lookup 404 Not Found.
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-merchant] 18/22: proposal-lookup 404 Not Found. |
Date: |
Sat, 17 Mar 2018 01:58:43 +0100 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository merchant.
commit aa9699384375813371016dfaf89920e1118d4f4a
Author: Marcello Stanisci <address@hidden>
AuthorDate: Fri Mar 16 16:50:40 2018 +0100
proposal-lookup 404 Not Found.
---
src/include/taler_merchant_testing_lib.h | 3 ++-
src/lib/merchant_api_proposal.c | 14 ++++--------
src/lib/test_merchant_api_new.c | 3 ++-
src/lib/test_merchant_api_twisted.c | 14 ++++++++----
src/lib/testing_api_cmd_proposal.c | 39 +++++++++++++++++++++++---------
5 files changed, 46 insertions(+), 27 deletions(-)
diff --git a/src/include/taler_merchant_testing_lib.h
b/src/include/taler_merchant_testing_lib.h
index c155eb1..c487edb 100644
--- a/src/include/taler_merchant_testing_lib.h
+++ b/src/include/taler_merchant_testing_lib.h
@@ -103,7 +103,8 @@ TALER_TESTING_cmd_proposal_lookup
struct GNUNET_CURL_Context *ctx,
const char *merchant_url,
unsigned int http_status,
- const char *proposal_reference);
+ const char *proposal_reference,
+ const char *order_id);
/**
* Make a "check payment" test command.
diff --git a/src/lib/merchant_api_proposal.c b/src/lib/merchant_api_proposal.c
index 688e8ce..a670f8b 100644
--- a/src/lib/merchant_api_proposal.c
+++ b/src/lib/merchant_api_proposal.c
@@ -279,17 +279,11 @@ handle_proposal_lookup_finished (void *cls,
if (MHD_HTTP_OK != response_code)
{
- char *s;
-
- s = json_dumps (json,
- JSON_COMPACT);
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Proposal lookup failed with HTTP status code %u on input
`%s'\n",
- (unsigned int) response_code,
- s);
- if (NULL != s)
- free (s);
- GNUNET_break_op (0);
+ "Proposal lookup failed with HTTP status code %u\n",
+ (unsigned int) response_code);
+ GNUNET_break (0);
+
plo->cb (plo->cb_cls,
response_code,
json,
diff --git a/src/lib/test_merchant_api_new.c b/src/lib/test_merchant_api_new.c
index b2979fa..444636d 100644
--- a/src/lib/test_merchant_api_new.c
+++ b/src/lib/test_merchant_api_new.c
@@ -337,7 +337,8 @@ run (void *cls,
is->ctx,
merchant_url,
MHD_HTTP_OK,
- "create-proposal-2"),
+ "create-proposal-2",
+ NULL),
TALER_TESTING_cmd_check_bank_empty ("check_bank_empty-1"),
diff --git a/src/lib/test_merchant_api_twisted.c
b/src/lib/test_merchant_api_twisted.c
index 3ee5042..31d0dd8 100644
--- a/src/lib/test_merchant_api_twisted.c
+++ b/src/lib/test_merchant_api_twisted.c
@@ -259,7 +259,6 @@ run (void *cls,
TALER_TESTING_cmd_delete_object ("remove-order-id",
PROXY_MERCHANT_CONFIG_FILE,
"order_id"),
-
TALER_TESTING_cmd_proposal
("create-proposal-3",
twister_merchant_url,
@@ -280,10 +279,9 @@ run (void *cls,
\"products\": [ {\"description\":\"ice cream\",\
\"value\":\"{EUR:5}\"} ] }",
NULL),
-
-
/**
- * Cause a 404 Not Found response code.
+ * Cause a 404 Not Found response code,
+ * due to a non existing merchant instance.
*/
TALER_TESTING_cmd_proposal
("create-proposal-4",
@@ -294,6 +292,14 @@ run (void *cls,
\"summary\": \"merchant-lib testcase\"}",
"non-existent-instance"),
+ /* Cause a 404 Not Found from /proposal/lookup,
+ * due to a non existing order id being queried. */
+ TALER_TESTING_cmd_proposal_lookup ("lookup-0",
+ is->ctx,
+ twister_merchant_url,
+ MHD_HTTP_NOT_FOUND,
+ NULL,
+ "does-not-exist"),
/**** Covering /history lib ****/
/**
diff --git a/src/lib/testing_api_cmd_proposal.c
b/src/lib/testing_api_cmd_proposal.c
index 410f44e..4529e40 100644
--- a/src/lib/testing_api_cmd_proposal.c
+++ b/src/lib/testing_api_cmd_proposal.c
@@ -135,6 +135,8 @@ struct ProposalLookupState
* Reference to a proposal operation.
*/
const char *proposal_reference;
+
+ const char *order_id;
};
/**
@@ -513,24 +515,37 @@ proposal_lookup_run (void *cls,
const struct TALER_TESTING_Command *proposal_cmd;
const char *order_id;
const struct GNUNET_CRYPTO_EddsaPublicKey *nonce;
+ /* Only used if we do NOT use the nonce from traits. */
+ struct GNUNET_CRYPTO_EddsaPublicKey dummy_nonce;
#define GET_TRAIT_NONCE(cmd,ptr) \
TALER_TESTING_get_trait_peer_key_pub (cmd, 1, ptr)
pls->is = is;
- proposal_cmd = TALER_TESTING_interpreter_lookup_command
- (is, pls->proposal_reference);
- if (NULL == proposal_cmd)
- TALER_TESTING_FAIL (is);
+ if (NULL != pls->order_id)
+ {
+ order_id = pls->order_id;
+ GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
+ &dummy_nonce,
+ sizeof (dummy_nonce));
+ nonce = &dummy_nonce;
+ }
+ else
+ {
+ proposal_cmd = TALER_TESTING_interpreter_lookup_command
+ (is, pls->proposal_reference);
- if (GNUNET_OK != GET_TRAIT_NONCE (proposal_cmd,
- &nonce))
- TALER_TESTING_FAIL (is);
+ if (NULL == proposal_cmd)
+ TALER_TESTING_FAIL (is);
- if (GNUNET_OK != TALER_TESTING_get_trait_order_id
- (proposal_cmd, 0, &order_id))
- TALER_TESTING_FAIL (is);
+ if (GNUNET_OK != GET_TRAIT_NONCE (proposal_cmd,
+ &nonce))
+ TALER_TESTING_FAIL (is);
+ if (GNUNET_OK != TALER_TESTING_get_trait_order_id
+ (proposal_cmd, 0, &order_id))
+ TALER_TESTING_FAIL (is);
+ }
pls->plo = TALER_MERCHANT_proposal_lookup (pls->ctx,
pls->merchant_url,
order_id,
@@ -554,7 +569,8 @@ TALER_TESTING_cmd_proposal_lookup
struct GNUNET_CURL_Context *ctx,
const char *merchant_url,
unsigned int http_status,
- const char *proposal_reference)
+ const char *proposal_reference,
+ const char *order_id)
{
struct ProposalLookupState *pls;
struct TALER_TESTING_Command cmd;
@@ -564,6 +580,7 @@ TALER_TESTING_cmd_proposal_lookup
pls->proposal_reference = proposal_reference;
pls->merchant_url = merchant_url;
pls->ctx = ctx;
+ pls->order_id = order_id;
cmd.cls = pls;
cmd.label = label;
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [taler-merchant] 14/22: /proposal cb called with response code == 0., (continued)
- [GNUnet-SVN] [taler-merchant] 14/22: /proposal cb called with response code == 0., gnunet, 2018/03/16
- [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 <=
- [GNUnet-SVN] [taler-merchant] 12/22: Double twister instance plus first coverage effort, gnunet, 2018/03/16