gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: remove abort-pay test


From: gnunet
Subject: [taler-wallet-core] branch master updated: remove abort-pay test
Date: Mon, 05 Sep 2022 12:22:02 +0200

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

dold pushed a commit to branch master
in repository wallet-core.

The following commit(s) were added to refs/heads/master by this push:
     new 4aaece0e remove abort-pay test
4aaece0e is described below

commit 4aaece0eff2e5cccfcb21a3ae9ec99b59f3f96a2
Author: Florian Dold <florian@dold.me>
AuthorDate: Mon Sep 5 12:20:47 2022 +0200

    remove abort-pay test
    
    This test can't work anymore, as the merchant does batch deposits.
    We should eventually add a different test as replacement that uses a
    double-spent coin (via a forced coin selection).
---
 .../src/integrationtests/test-pay-abort.ts         | 156 ---------------------
 .../src/integrationtests/testrunner.ts             |   2 -
 2 files changed, 158 deletions(-)

diff --git a/packages/taler-wallet-cli/src/integrationtests/test-pay-abort.ts 
b/packages/taler-wallet-cli/src/integrationtests/test-pay-abort.ts
deleted file mode 100644
index 09b546f4..00000000
--- a/packages/taler-wallet-cli/src/integrationtests/test-pay-abort.ts
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2020 Taler Systems S.A.
-
- GNU Taler is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
- */
-
-/**
- * Fault injection test to check aborting partial payment
- * via refunds.
- */
-
-/**
- * Imports.
- */
-import { URL, PreparePayResultType, TalerErrorCode } from 
"@gnu-taler/taler-util";
-import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
-import {
-  FaultInjectionRequestContext,
-  FaultInjectionResponseContext,
-} from "../harness/faultInjection";
-import { GlobalTestState, MerchantPrivateApi, setupDb } from 
"../harness/harness.js";
-import {
-  createFaultInjectedMerchantTestkudosEnvironment,
-  withdrawViaBank,
-} from "../harness/helpers.js";
-
-/**
- * Run test for basic, bank-integrated withdrawal.
- */
-export async function runPayAbortTest(t: GlobalTestState) {
-  const {
-    bank,
-    faultyExchange,
-    wallet,
-    faultyMerchant,
-  } = await createFaultInjectedMerchantTestkudosEnvironment(t);
-  // Set up test environment
-
-  await withdrawViaBank(t, {
-    wallet,
-    exchange: faultyExchange,
-    amount: "TESTKUDOS:20",
-    bank,
-  });
-
-  const orderResp = await MerchantPrivateApi.createOrder(
-    faultyMerchant,
-    "default",
-    {
-      order: {
-        summary: "Buy me!",
-        amount: "TESTKUDOS:15",
-        fulfillment_url: "taler://fulfillment-success/thx",
-      },
-    },
-  );
-
-  let orderStatus = await MerchantPrivateApi.queryPrivateOrderStatus(
-    faultyMerchant,
-    {
-      orderId: orderResp.order_id,
-    },
-  );
-
-  t.assertTrue(orderStatus.order_status === "unpaid");
-
-  // Make wallet pay for the order
-
-  const preparePayResult = await wallet.client.call(
-    WalletApiOperation.PreparePayForUri,
-    {
-      talerPayUri: orderStatus.taler_pay_uri,
-    },
-  );
-
-  t.assertTrue(
-    preparePayResult.status === PreparePayResultType.PaymentPossible,
-  );
-
-  // We let only the first deposit through!
-  let firstDepositUrl: string | undefined;
-
-  faultyExchange.faultProxy.addFault({
-    async modifyRequest(ctx: FaultInjectionRequestContext) {
-      const url = new URL(ctx.requestUrl);
-      if (url.pathname.endsWith("/deposit")) {
-        if (!firstDepositUrl) {
-          firstDepositUrl = url.href;
-          return;
-        }
-        if (url.href != firstDepositUrl) {
-          url.pathname = "/doesntexist";
-          ctx.requestUrl = url.href;
-        }
-      }
-    },
-    async modifyResponse(ctx: FaultInjectionResponseContext) {
-      const url = new URL(ctx.request.requestUrl);
-      if (url.pathname.endsWith("/deposit") && url.href != firstDepositUrl) {
-        ctx.responseBody = Buffer.from("{}");
-        ctx.statusCode = 500;
-      }
-    },
-  });
-
-  faultyMerchant.faultProxy.addFault({
-    async modifyResponse(ctx: FaultInjectionResponseContext) {
-      const url = new URL(ctx.request.requestUrl);
-      if (url.pathname.endsWith("/pay") && url.href != firstDepositUrl) {
-        ctx.responseBody = Buffer.from("{}");
-        ctx.statusCode = 400;
-      }
-    },
-  });
-
-  await t.assertThrowsTalerErrorAsync(async () => {
-    await wallet.client.call(WalletApiOperation.ConfirmPay, {
-      proposalId: preparePayResult.proposalId,
-    });
-  });
-
-  let txr = await wallet.client.call(WalletApiOperation.GetTransactions, {});
-  console.log(JSON.stringify(txr, undefined, 2));
-
-  t.assertDeepEqual(txr.transactions[1].type, "payment");
-  t.assertDeepEqual(txr.transactions[1].pending, true);
-  t.assertDeepEqual(
-    txr.transactions[1].error?.code,
-    TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,
-  );
-
-  await wallet.client.call(WalletApiOperation.AbortFailedPayWithRefund, {
-    proposalId: preparePayResult.proposalId,
-  });
-
-  await wallet.runUntilDone();
-
-  txr = await wallet.client.call(WalletApiOperation.GetTransactions, {});
-  console.log(JSON.stringify(txr, undefined, 2));
-
-  const txTypes = txr.transactions.map((x) => x.type);
-
-  t.assertDeepEqual(txTypes, ["withdrawal", "payment", "refund"]);
-}
-
-runPayAbortTest.suites = ["wallet"];
diff --git a/packages/taler-wallet-cli/src/integrationtests/testrunner.ts 
b/packages/taler-wallet-cli/src/integrationtests/testrunner.ts
index 74aa6600..69905730 100644
--- a/packages/taler-wallet-cli/src/integrationtests/testrunner.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/testrunner.ts
@@ -61,7 +61,6 @@ import { runMerchantInstancesUrlsTest } from 
"./test-merchant-instances-urls.js"
 import { runMerchantLongpollingTest } from "./test-merchant-longpolling.js";
 import { runMerchantRefundApiTest } from "./test-merchant-refund-api.js";
 import { runMerchantSpecPublicOrdersTest } from 
"./test-merchant-spec-public-orders.js";
-import { runPayAbortTest } from "./test-pay-abort.js";
 import { runPayPaidTest } from "./test-pay-paid.js";
 import { runPaymentTest } from "./test-payment.js";
 import { runPaymentClaimTest } from "./test-payment-claim.js";
@@ -143,7 +142,6 @@ const allTests: TestMainFunction[] = [
   runMerchantLongpollingTest,
   runMerchantSpecPublicOrdersTest,
   runMerchantRefundApiTest,
-  runPayAbortTest,
   runPaymentClaimTest,
   runPaymentFaultTest,
   runPaymentForgettableTest,

-- 
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]