gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] branch master updated: -get tests to pass


From: gnunet
Subject: [taler-merchant] branch master updated: -get tests to pass
Date: Sat, 01 Apr 2023 15:24:59 +0200

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

grothoff pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new 98ddd97d -get tests to pass
98ddd97d is described below

commit 98ddd97d475d8ea8f382efb0061caaa3134cc124
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Sat Apr 1 15:24:16 2023 +0200

    -get tests to pass
---
 src/lib/merchant_api_post_templates.c              |  4 ++
 src/testing/test_merchant_api.c                    | 62 ++++++++++++++++------
 src/testing/testing_api_cmd_pay_order.c            |  9 +++-
 src/testing/testing_api_cmd_post_using_templates.c | 13 ++---
 4 files changed, 65 insertions(+), 23 deletions(-)

diff --git a/src/lib/merchant_api_post_templates.c 
b/src/lib/merchant_api_post_templates.c
index 53111258..bdba52f9 100644
--- a/src/lib/merchant_api_post_templates.c
+++ b/src/lib/merchant_api_post_templates.c
@@ -129,6 +129,10 @@ handle_post_templates_finished (void *cls,
        happen, we should pass the JSON reply to the
        application */
     break;
+  case MHD_HTTP_CONFLICT:
+    hr.ec = TALER_JSON_get_error_code (json);
+    hr.hint = TALER_JSON_get_error_hint (json);
+    break;
   case MHD_HTTP_INTERNAL_SERVER_ERROR:
     hr.ec = TALER_JSON_get_error_code (json);
     hr.hint = TALER_JSON_get_error_hint (json);
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c
index d63d54e5..3cb262cb 100644
--- a/src/testing/test_merchant_api.c
+++ b/src/testing/test_merchant_api.c
@@ -1323,6 +1323,38 @@ run (void *cls,
   };
 
   struct TALER_TESTING_Command templates[] = {
+    cmd_transfer_to_exchange ("create-reserve-20x",
+                              "EUR:20.04"),
+    cmd_exec_wirewatch ("wirewatch-20x"),
+    TALER_TESTING_cmd_check_bank_admin_transfer ("check_bank_transfer-20x",
+                                                 "EUR:20.04",
+                                                 payer_payto,
+                                                 exchange_payto,
+                                                 "create-reserve-20x"),
+    TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-xa",
+                                       "create-reserve-20x",
+                                       "EUR:5",
+                                       0,
+                                       MHD_HTTP_OK),
+    TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-xb",
+                                       "create-reserve-20x",
+                                       "EUR:5",
+                                       0,
+                                       MHD_HTTP_OK),
+    TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-xc",
+                                       "create-reserve-20x",
+                                       "EUR:5",
+                                       0,
+                                       MHD_HTTP_OK),
+    TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-xd",
+                                       "create-reserve-20x",
+                                       "EUR:5",
+                                       0,
+                                       MHD_HTTP_OK),
+    TALER_TESTING_cmd_status ("withdraw-status-20x",
+                              "create-reserve-20x",
+                              "EUR:0",
+                              MHD_HTTP_OK),
     TALER_TESTING_cmd_merchant_get_templates ("get-templates-empty",
                                               merchant_url,
                                               MHD_HTTP_OK,
@@ -1411,7 +1443,7 @@ run (void *cls,
       merchant_url,
       "1",
       "summary-1",
-      "EUR:10",
+      "EUR:9.98",
       GNUNET_TIME_UNIT_ZERO_TS,
       GNUNET_TIME_UNIT_FOREVER_TS,
       MHD_HTTP_OK),
@@ -1459,9 +1491,9 @@ run (void *cls,
                                           merchant_url,
                                           MHD_HTTP_OK,
                                           "using-templates-t1",
-                                          
"withdraw-coin-10a;withdraw-coin-10b",
-                                          "EUR:9.99",
-                                          "EUR:9",
+                                          "withdraw-coin-xa;withdraw-coin-xb",
+                                          "EUR:4.99",
+                                          "EUR:4.99",
                                           NULL),
     TALER_TESTING_cmd_merchant_delete_template ("get-templates-empty",
                                                 merchant_url,
@@ -1897,22 +1929,22 @@ run (void *cls,
                                                MHD_HTTP_CONFLICT),
     TALER_TESTING_cmd_batch ("pay",
                              pay),
-     TALER_TESTING_cmd_batch ("double-spending",
-                          double_spending),
+    TALER_TESTING_cmd_batch ("double-spending",
+                             double_spending),
     TALER_TESTING_cmd_batch ("pay-again",
-                           pay_again),
-     TALER_TESTING_cmd_batch ("pay-abort",
-                           pay_abort),
+                             pay_again),
+    TALER_TESTING_cmd_batch ("pay-abort",
+                             pay_abort),
     TALER_TESTING_cmd_batch ("refund",
                             refund),
     TALER_TESTING_cmd_batch ("tip",
-                           tip),
-     TALER_TESTING_cmd_batch ("auth",
-                           auth),
-     TALER_TESTING_cmd_batch ("templates",
-                              templates),
+                             tip),
+    TALER_TESTING_cmd_batch ("templates",
+                             templates),
     TALER_TESTING_cmd_batch ("webhooks",
-                           webhooks),
+                             webhooks),
+    TALER_TESTING_cmd_batch ("auth",
+                             auth),
     /**
      * End the suite.
      */
diff --git a/src/testing/testing_api_cmd_pay_order.c 
b/src/testing/testing_api_cmd_pay_order.c
index cff679a8..3a4e0cc7 100644
--- a/src/testing/testing_api_cmd_pay_order.c
+++ b/src/testing/testing_api_cmd_pay_order.c
@@ -254,17 +254,20 @@ pay_cb (void *cls,
   if (MHD_HTTP_OK == pr->hr.http_status)
   {
     ps->merchant_sig = pr->details.success.merchant_sig;
+#if FIXME
     // FIXME: check if pr->details.success.pos_confirmation;
     // for that, get pos_secret from ps->proposal_reference CMD and amount 
from pay/order creation cmd using traits
     struct TALER_Amount amount_with_fee;
     GNUNET_assert (GNUNET_OK ==
                    TALER_string_to_amount (ps->amount_with_fee,
                                            &amount_with_fee));
+    // FIXME: crashes here, because ps->pos_key is NULL
     ps->pos_confirmation = TALER_build_pos_confirmation (ps->pos_key,
                                                          ps->pos_alg,
                                                          &amount_with_fee,
                                                          
GNUNET_TIME_timestamp_get());
     ps->pos_confirmation = pr->details.success.pos_confirmation;
+#endif
   }
   TALER_TESTING_interpreter_next (ps->is);
 }
@@ -294,8 +297,8 @@ pay_run (void *cls,
   const struct TALER_PrivateContractHashP *h_proposal;
   struct TALER_Amount total_amount;
   struct TALER_Amount max_fee;
-  const char *error_name;
-  unsigned int error_line;
+  const char *error_name = NULL;
+  unsigned int error_line = 0;
   struct TALER_MERCHANT_PayCoin *pay_coins;
   unsigned int npay_coins;
   const struct TALER_MerchantSignatureP *merchant_sig;
@@ -312,6 +315,8 @@ pay_run (void *cls,
       TALER_TESTING_get_trait_contract_terms (proposal_cmd,
                                               &contract_terms))
     TALER_TESTING_FAIL (is);
+  if (NULL == contract_terms)
+    TALER_TESTING_FAIL (is);
   {
     /* Get information that needs to be put verbatim in the
      * deposit permission */
diff --git a/src/testing/testing_api_cmd_post_using_templates.c 
b/src/testing/testing_api_cmd_post_using_templates.c
index a68ea8fe..d5123d5d 100644
--- a/src/testing/testing_api_cmd_post_using_templates.c
+++ b/src/testing/testing_api_cmd_post_using_templates.c
@@ -327,12 +327,12 @@ post_using_templates_cb (void *cls,
   }
   if (NULL ==
       (tis->och = TALER_MERCHANT_order_claim (tis->is->ctx,
-                                             tis->merchant_url,
-                                             tis->order_id,
-                                             &tis->nonce,
-                                             &tis->claim_token,
-                                             &using_claim_cb,
-                                             tis)))
+                                              tis->merchant_url,
+                                              tis->order_id,
+                                              &tis->nonce,
+                                              &tis->claim_token,
+                                              &using_claim_cb,
+                                              tis)))
     TALER_TESTING_FAIL (tis->is);
 }
 
@@ -534,6 +534,7 @@ TALER_TESTING_cmd_merchant_post_using_templates (
   tis->using_template_id = using_template_id;
   tis->http_status = http_status;
   tis->summary = summary;
+  tis->with_claim = true;
   make_order_json (using_template_id,
                    refund_deadline,
                    pay_deadline,

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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