gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-merchant] 17/22: trigger 404 @ /proposal


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] 17/22: trigger 404 @ /proposal
Date: Sat, 17 Mar 2018 01:58:42 +0100

This is an automated email from the git hooks/post-receive script.

marcello pushed a commit to branch master
in repository merchant.

commit 8f05359b58b7ec1f9772f48d594b526ec9765f61
Author: Marcello Stanisci <address@hidden>
AuthorDate: Fri Mar 16 14:47:42 2018 +0100

    trigger 404 @ /proposal
---
 src/backend/taler-merchant-httpd_proposal.c | 10 ++++++----
 src/lib/test_merchant_api_twisted.c         | 15 ++++++++++++++-
 src/lib/testing_api_cmd_proposal.c          |  2 +-
 3 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_proposal.c 
b/src/backend/taler-merchant-httpd_proposal.c
index 4d0298b..1cdea4a 100644
--- a/src/backend/taler-merchant-httpd_proposal.c
+++ b/src/backend/taler-merchant-httpd_proposal.c
@@ -281,6 +281,7 @@ proposal_put (struct MHD_Connection *connection,
 
   if (NULL == instance)
   {
+    TALER_LOG_DEBUG ("Giving 'default' instance\n");
     instance = "default";
   }
 
@@ -296,9 +297,10 @@ proposal_put (struct MHD_Connection *connection,
 
     if (NULL == mi)
     {
-      return TMH_RESPONSE_reply_internal_error (connection,
-                                                
TALER_EC_PROPOSAL_ORDER_PARSE_ERROR,
-                                                "merchant instance not found");
+      TALER_LOG_WARNING ("Does 'default' instance exist?\n");
+      return TMH_RESPONSE_reply_not_found (connection,
+                                           TALER_EC_CONTRACT_INSTANCE_UNKNOWN,
+                                           "merchant instance (order:instance) 
not found");
     }
     if (NULL == json_object_get (order, "merchant"))
     {
@@ -385,7 +387,7 @@ proposal_put (struct MHD_Connection *connection,
     GNUNET_JSON_parse_free (spec);
     return TMH_RESPONSE_reply_not_found (connection,
                                         TALER_EC_CONTRACT_INSTANCE_UNKNOWN,
-                                        "Unknown instance given");
+                                        "Unknown instance 
(order:merchant:instance) given");
   }
   /* add fields to the contract that the backend should provide */
   json_object_set (order,
diff --git a/src/lib/test_merchant_api_twisted.c 
b/src/lib/test_merchant_api_twisted.c
index 8c02cb4..3ee5042 100644
--- a/src/lib/test_merchant_api_twisted.c
+++ b/src/lib/test_merchant_api_twisted.c
@@ -261,7 +261,7 @@ run (void *cls,
                                      "order_id"),
 
     TALER_TESTING_cmd_proposal
-      ("create-proposal-1",
+      ("create-proposal-3",
        twister_merchant_url,
        is->ctx,
        0,
@@ -281,6 +281,19 @@ run (void *cls,
                          \"value\":\"{EUR:5}\"} ] }",
         NULL),
 
+
+    /**
+     * Cause a 404 Not Found response code.
+     */
+    TALER_TESTING_cmd_proposal
+      ("create-proposal-4",
+       twister_merchant_url,
+       is->ctx,
+       MHD_HTTP_NOT_FOUND,
+       "{\"amount\":\"EUR:5\",\
+         \"summary\": \"merchant-lib testcase\"}",
+       "non-existent-instance"),
+
     /**** Covering /history lib ****/
 
     /**
diff --git a/src/lib/testing_api_cmd_proposal.c 
b/src/lib/testing_api_cmd_proposal.c
index e066c4c..410f44e 100644
--- a/src/lib/testing_api_cmd_proposal.c
+++ b/src/lib/testing_api_cmd_proposal.c
@@ -458,6 +458,7 @@ TALER_TESTING_cmd_proposal (const char *label,
   ps->http_status = http_status;
   ps->ctx = ctx;
   ps->merchant_url = merchant_url;
+  ps->instance = instance;
 
   cmd.cls = ps;
   cmd.label = label;
@@ -541,7 +542,6 @@ proposal_lookup_run (void *cls,
 }
 
 
-
 /**
  * Make a "proposal lookup" command.
  *

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]