[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-merchant] 09/12: testing until last pickup ("too muc
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-merchant] 09/12: testing until last pickup ("too much" one) |
Date: |
Mon, 26 Mar 2018 10:38:03 +0200 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository merchant.
commit dfd4806100b0f3dc4f5947b3a85872b08d64981b
Author: Marcello Stanisci <address@hidden>
AuthorDate: Fri Mar 23 13:35:37 2018 +0100
testing until last pickup ("too much" one)
---
src/include/taler_merchant_testing_lib.h | 33 ++++++++++++++
src/lib/test_merchant_api.c | 1 +
src/lib/test_merchant_api_new.c | 44 +++++++++++++++++++
src/lib/testing_api_cmd_tip.c | 74 ++++++++++++++++++++++++++++++++
4 files changed, 152 insertions(+)
diff --git a/src/include/taler_merchant_testing_lib.h
b/src/include/taler_merchant_testing_lib.h
index a242e6d..67ca40a 100644
--- a/src/include/taler_merchant_testing_lib.h
+++ b/src/include/taler_merchant_testing_lib.h
@@ -497,6 +497,23 @@ TALER_TESTING_get_trait_refund_entry
unsigned int index,
const struct TALER_MERCHANT_RefundEntry **refund_entry);
+
+/**
+ * FIXME
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_tip_authorize_with_ec
+ (const char *label,
+ const char *merchant_url,
+ const char *exchange_url,
+ struct GNUNET_CURL_Context *ctx,
+ unsigned int http_status,
+ const char *instance,
+ const char *justification,
+ const char *amount,
+ enum TALER_ErrorCode ec);
+
+
/**
* FIXME
*/
@@ -534,6 +551,22 @@ TALER_TESTING_cmd_tip_query_with_amounts
const char *expected_amount_authorized,
const char *expected_amount_available);
+
+/**
+ * FIXME
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_tip_pickup_with_ec
+ (const char *label,
+ const char *merchant_url,
+ struct GNUNET_CURL_Context *ctx,
+ unsigned int http_status,
+ const char *authorize_reference,
+ const char **amounts,
+ struct TALER_EXCHANGE_Handle *exchange,
+ enum TALER_ErrorCode ec);
+
+
/**
* FIXME
*/
diff --git a/src/lib/test_merchant_api.c b/src/lib/test_merchant_api.c
index 807376c..3177a1a 100644
--- a/src/lib/test_merchant_api.c
+++ b/src/lib/test_merchant_api.c
@@ -4625,6 +4625,7 @@ run (void *cls)
.details.tip_authorize.justification = "tip 5",
.details.tip_authorize.amount = "EUR:5.01",
.details.tip_authorize.expected_ec =
TALER_EC_TIP_AUTHORIZE_INSTANCE_DOES_NOT_TIP },
+
{ .oc = OC_TIP_PICKUP,
.label = "pickup-tip-3-too-much",
.expected_response_code = MHD_HTTP_CONFLICT,
diff --git a/src/lib/test_merchant_api_new.c b/src/lib/test_merchant_api_new.c
index c444c2f..2b6ad91 100644
--- a/src/lib/test_merchant_api_new.c
+++ b/src/lib/test_merchant_api_new.c
@@ -35,6 +35,7 @@
#include <taler/taler_bank_service.h>
#include <taler/taler_fakebank_lib.h>
#include <taler/taler_testing_lib.h>
+#include <taler/taler_error_codes.h>
#include "taler_merchant_testing_lib.h"
/**
@@ -547,6 +548,49 @@ run (void *cls,
"EUR:10.02", // pick
"EUR:10.02", // auth
"EUR:10.02"), // ava
+ TALER_TESTING_cmd_tip_authorize_with_ec
+ ("authorize-tip-3-insufficient-funds",
+ merchant_url,
+ exchange_url,
+ is->ctx,
+ MHD_HTTP_PRECONDITION_FAILED,
+ "dtip",
+ "tip 3",
+ "EUR:5.01",
+ TALER_EC_TIP_AUTHORIZE_INSUFFICIENT_FUNDS),
+
+ TALER_TESTING_cmd_tip_authorize_with_ec
+ ("authorize-tip-4-unknown-instance",
+ merchant_url,
+ exchange_url,
+ is->ctx,
+ MHD_HTTP_NOT_FOUND,
+ "unknown",
+ "tip 4",
+ "EUR:5.01",
+ TALER_EC_TIP_AUTHORIZE_INSTANCE_UNKNOWN),
+
+ TALER_TESTING_cmd_tip_authorize_with_ec
+ ("authorize-tip-5-notip-instance",
+ merchant_url,
+ exchange_url,
+ is->ctx,
+ MHD_HTTP_NOT_FOUND,
+ "default",
+ "tip 5",
+ "EUR:5.01",
+ TALER_EC_TIP_AUTHORIZE_INSTANCE_DOES_NOT_TIP),
+
+
+ TALER_TESTING_cmd_tip_pickup_with_ec
+ ("pickup-tip-3-too-much",
+ merchant_url,
+ is->ctx,
+ MHD_HTTP_CONFLICT,
+ "authorize-tip-1",
+ pickup_amounts_1,
+ is->exchange,
+ TALER_EC_TIP_PICKUP_NO_FUNDS),
/* Will fail here until all new
* transfers have not been checked. I.e.,
diff --git a/src/lib/testing_api_cmd_tip.c b/src/lib/testing_api_cmd_tip.c
index eb87034..c784dbc 100644
--- a/src/lib/testing_api_cmd_tip.c
+++ b/src/lib/testing_api_cmd_tip.c
@@ -287,6 +287,44 @@ tip_authorize_cleanup (void *cls,
* FIXME
*/
struct TALER_TESTING_Command
+TALER_TESTING_cmd_tip_authorize_with_ec
+ (const char *label,
+ const char *merchant_url,
+ const char *exchange_url,
+ struct GNUNET_CURL_Context *ctx,
+ unsigned int http_status,
+ const char *instance,
+ const char *justification,
+ const char *amount,
+ enum TALER_ErrorCode ec)
+{
+ struct TipAuthorizeState *tas;
+ struct TALER_TESTING_Command cmd;
+
+ tas = GNUNET_new (struct TipAuthorizeState);
+ tas->merchant_url = merchant_url;
+ tas->exchange_url = exchange_url;
+ tas->ctx = ctx;
+ tas->instance = instance;
+ tas->justification = justification;
+ tas->amount = amount;
+ tas->http_status = http_status;
+ tas->expected_ec = ec;
+
+ cmd.label = label;
+ cmd.cls = tas;
+ cmd.run = &tip_authorize_run;
+ cmd.cleanup = &tip_authorize_cleanup;
+ cmd.traits = &tip_authorize_traits;
+
+ return cmd;
+}
+
+
+/**
+ * FIXME
+ */
+struct TALER_TESTING_Command
TALER_TESTING_cmd_tip_authorize (const char *label,
const char *merchant_url,
const char *exchange_url,
@@ -815,6 +853,42 @@ tip_pickup_traits (void *cls,
* FIXME
*/
struct TALER_TESTING_Command
+TALER_TESTING_cmd_tip_pickup_with_ec
+ (const char *label,
+ const char *merchant_url,
+ struct GNUNET_CURL_Context *ctx,
+ unsigned int http_status,
+ const char *authorize_reference,
+ const char **amounts,
+ struct TALER_EXCHANGE_Handle *exchange,
+ enum TALER_ErrorCode ec)
+{
+ struct TipPickupState *tps;
+ struct TALER_TESTING_Command cmd;
+
+ tps = GNUNET_new (struct TipPickupState);
+ tps->merchant_url = merchant_url;
+ tps->ctx = ctx;
+ tps->authorize_reference = authorize_reference;
+ tps->amounts = amounts;
+ tps->exchange = exchange;
+ tps->http_status = http_status;
+ tps->expected_ec = ec;
+
+ cmd.cls = tps;
+ cmd.label = label;
+ cmd.run = &tip_pickup_run;
+ cmd.cleanup = &tip_pickup_cleanup;
+ cmd.traits = &tip_pickup_traits;
+
+ return cmd;
+}
+
+
+/**
+ * FIXME
+ */
+struct TALER_TESTING_Command
TALER_TESTING_cmd_tip_pickup
(const char *label,
const char *merchant_url,
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [taler-merchant] 04/12: putting tip-query under test., (continued)
- [GNUnet-SVN] [taler-merchant] 04/12: putting tip-query under test., gnunet, 2018/03/26
- [GNUnet-SVN] [taler-merchant] 03/12: putting second tip-authorize under tests., gnunet, 2018/03/26
- [GNUnet-SVN] [taler-merchant] 11/12: extra bank checks (no pass now), gnunet, 2018/03/26
- [GNUnet-SVN] [taler-merchant] 02/12: putting tip-authorize into tests., gnunet, 2018/03/26
- [GNUnet-SVN] [taler-merchant] 10/12: spending tip passes., gnunet, 2018/03/26
- [GNUnet-SVN] [taler-merchant] 12/12: fix tipping test aftermath., gnunet, 2018/03/26
- [GNUnet-SVN] [taler-merchant] 06/12: putting tip-pickup under test., gnunet, 2018/03/26
- [GNUnet-SVN] [taler-merchant] 01/12: fix confusion about reserve creation, gnunet, 2018/03/26
- [GNUnet-SVN] [taler-merchant] 05/12: putting query with amounts under test., gnunet, 2018/03/26
- [GNUnet-SVN] [taler-merchant] 07/12: after pickup query under test., gnunet, 2018/03/26
- [GNUnet-SVN] [taler-merchant] 09/12: testing until last pickup ("too much" one),
gnunet <=