gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: harness: make libeufin-bank t


From: gnunet
Subject: [taler-wallet-core] branch master updated: harness: make libeufin-bank test work with current libeufin-bank
Date: Mon, 08 Jan 2024 12:22:34 +0100

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 82cea8678 harness: make libeufin-bank test work with current 
libeufin-bank
82cea8678 is described below

commit 82cea86785fc9ab6aa5440cc077e8f2024b33c13
Author: Florian Dold <florian@dold.me>
AuthorDate: Mon Jan 8 12:22:32 2024 +0100

    harness: make libeufin-bank test work with current libeufin-bank
---
 packages/taler-harness/src/harness/harness.ts      | 23 ++++++++---------
 .../src/integrationtests/test-libeufin-bank.ts     |  7 ++++-
 .../integrationtests/test-wallet-backup-basic.ts   | 30 +++++++++++++++++-----
 .../src/integrationtests/test-wallettesting.ts     |  7 ++---
 packages/taler-util/src/bank-api-client.ts         |  6 ++---
 .../src/operations/pay-peer-push-debit.ts          |  1 +
 6 files changed, 46 insertions(+), 28 deletions(-)

diff --git a/packages/taler-harness/src/harness/harness.ts 
b/packages/taler-harness/src/harness/harness.ts
index 27c54b8b4..ea2406f52 100644
--- a/packages/taler-harness/src/harness/harness.ts
+++ b/packages/taler-harness/src/harness/harness.ts
@@ -729,7 +729,7 @@ export class FakebankService
 }
 
 /**
- * Implementation of the bank service using the "taler-fakebank-run" tool.
+ * Implementation of the bank service using the libeufin-bank implementation.
  */
 export class LibeufinBankService
   extends BankServiceBase
@@ -766,21 +766,14 @@ export class LibeufinBankService
     config.setString("libeufin-bank", "serve", "tcp");
     config.setString(
       "libeufin-bank",
-      "DEFAULT_CUSTOMER_DEBT_LIMIT",
-      `${bc.currency}:500`,
-    );
-    config.setString(
-      "libeufin-bank",
-      "DEFAULT_ADMIN_DEBT_LIMIT",
-      `${bc.currency}:999999`,
+      "DEFAULT_DEBT_LIMIT",
+      `${bc.currency}:100`,
     );
     config.setString(
       "libeufin-bank",
       "registration_bonus",
       `${bc.currency}:100`,
     );
-    config.setString("libeufin-bank", "registration_bonus_enabled", `yes`);
-    config.setString("libeufin-bank", "max_auth_token_duration", "1h");
     const cfgFilename = testDir + "/bank.conf";
     config.write(cfgFilename, { excludeDefaults: true });
 
@@ -804,7 +797,7 @@ export class LibeufinBankService
         .required(),
       httpPort: config.getNumber("libeufin-bank", "port").required(),
       maxDebt: config
-        .getString("libeufin-bank", "DEFAULT_CUSTOMER_DEBT_LIMIT")
+        .getString("libeufin-bank", "DEFAULT_DEBT_LIMIT")
         .required(),
     };
     return new FakebankService(gc, bc, cfgFilename);
@@ -850,10 +843,16 @@ export class LibeufinBankService
 
     await sh(
       this.globalTestState,
-      "libeufin-bank-dbinit",
+      "libeufin-bank-passwd",
       `libeufin-bank passwd -c "${this.configFile}" admin adminpw`,
     );
 
+    await sh(
+      this.globalTestState,
+      "libeufin-bank-edit-account",
+      `libeufin-bank edit-account -c "${this.configFile}" admin 
--debit_threshold=${this.bankConfig.currency}:1000`,
+    );
+
     this.proc = this.globalTestState.spawnService(
       "libeufin-bank",
       ["serve", "-c", this.configFile],
diff --git a/packages/taler-harness/src/integrationtests/test-libeufin-bank.ts 
b/packages/taler-harness/src/integrationtests/test-libeufin-bank.ts
index 8f5cc8a35..a3e3a9ef1 100644
--- a/packages/taler-harness/src/integrationtests/test-libeufin-bank.ts
+++ b/packages/taler-harness/src/integrationtests/test-libeufin-bank.ts
@@ -125,7 +125,12 @@ export async function runLibeufinBankTest(t: 
GlobalTestState) {
 
   console.log("setup done!");
 
-  const bankClient = new TalerCorebankApiClient(bank.corebankApiBaseUrl);
+  const bankClient = new TalerCorebankApiClient(bank.corebankApiBaseUrl, {
+    auth: {
+      username: "admin",
+      password: "adminpw",
+    },
+  });
 
   // register exchange bank account
   await bankClient.registerAccountExtended({
diff --git 
a/packages/taler-harness/src/integrationtests/test-wallet-backup-basic.ts 
b/packages/taler-harness/src/integrationtests/test-wallet-backup-basic.ts
index 21ac662c2..cb4a50a2b 100644
--- a/packages/taler-harness/src/integrationtests/test-wallet-backup-basic.ts
+++ b/packages/taler-harness/src/integrationtests/test-wallet-backup-basic.ts
@@ -19,7 +19,7 @@
  */
 import { j2s } from "@gnu-taler/taler-util";
 import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
-import { GlobalTestState, WalletCli } from "../harness/harness.js";
+import { GlobalTestState } from "../harness/harness.js";
 import {
   createSimpleTestkudosEnvironmentV2,
   createWalletDaemonWithClient,
@@ -83,7 +83,12 @@ export async function runWalletBackupBasicTest(t: 
GlobalTestState) {
     );
   }
 
-  await withdrawViaBankV2(t, { walletClient, bank, exchange, amount: 
"TESTKUDOS:10" });
+  await withdrawViaBankV2(t, {
+    walletClient,
+    bank,
+    exchange,
+    amount: "TESTKUDOS:10",
+  });
 
   await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {});
 
@@ -94,7 +99,12 @@ export async function runWalletBackupBasicTest(t: 
GlobalTestState) {
     console.log(bi);
   }
 
-  await withdrawViaBankV2(t, { walletClient, bank, exchange, amount: 
"TESTKUDOS:5" });
+  await withdrawViaBankV2(t, {
+    walletClient,
+    bank,
+    exchange,
+    amount: "TESTKUDOS:5",
+  });
 
   await walletClient.call(WalletApiOperation.RunBackupCycle, {});
 
@@ -111,9 +121,12 @@ export async function runWalletBackupBasicTest(t: 
GlobalTestState) {
   const txs = await walletClient.call(WalletApiOperation.GetTransactions, {});
   console.log(`backed up transactions ${j2s(txs)}`);
 
-  const { walletClient: walletClient2 } = await 
createWalletDaemonWithClient(t, {
-    name: "w2"
-  });
+  const { walletClient: walletClient2 } = await createWalletDaemonWithClient(
+    t,
+    {
+      name: "w2",
+    },
+  );
 
   // Check that the second wallet is a fresh wallet.
   {
@@ -154,7 +167,10 @@ export async function runWalletBackupBasicTest(t: 
GlobalTestState) {
 
     await exchange.runWirewatchOnce();
 
-    await walletClient2.call(WalletApiOperation.TestingWaitTransactionsFinal, 
{});
+    await walletClient2.call(
+      WalletApiOperation.TestingWaitTransactionsFinal,
+      {},
+    );
 
     const txs2 = await walletClient2.call(
       WalletApiOperation.GetTransactions,
diff --git a/packages/taler-harness/src/integrationtests/test-wallettesting.ts 
b/packages/taler-harness/src/integrationtests/test-wallettesting.ts
index 6b4444d07..ec393204f 100644
--- a/packages/taler-harness/src/integrationtests/test-wallettesting.ts
+++ b/packages/taler-harness/src/integrationtests/test-wallettesting.ts
@@ -31,11 +31,9 @@ import {
   GlobalTestState,
   MerchantService,
   setupDb,
-  WalletCli,
   generateRandomPayto,
 } from "../harness/harness.js";
 import {
-  SimpleTestEnvironment,
   SimpleTestEnvironmentNg,
   createWalletDaemonWithClient,
 } from "../harness/helpers.js";
@@ -125,9 +123,8 @@ export async function createMyEnvironment(
  * Run test for basic, bank-integrated withdrawal.
  */
 export async function runWallettestingTest(t: GlobalTestState) {
-  const { walletClient, bank, exchange, merchant } = await createMyEnvironment(
-    t,
-  );
+  const { walletClient, bank, exchange, merchant } =
+    await createMyEnvironment(t);
 
   await walletClient.call(WalletApiOperation.RunIntegrationTest, {
     amountToSpend: "TESTKUDOS:5" as AmountString,
diff --git a/packages/taler-util/src/bank-api-client.ts 
b/packages/taler-util/src/bank-api-client.ts
index 14c9b5f3f..bc01dc8e8 100644
--- a/packages/taler-util/src/bank-api-client.ts
+++ b/packages/taler-util/src/bank-api-client.ts
@@ -300,6 +300,7 @@ export class TalerCorebankApiClient {
     const resp = await this.httpLib.fetch(url.href, {
       method: "POST",
       body: req,
+      headers: this.makeAuthHeader(),
     });
 
     if (
@@ -334,6 +335,7 @@ export class TalerCorebankApiClient {
         password,
         name: username,
       },
+      headers: this.makeAuthHeader(),
     });
     if (
       resp.status !== 200 &&
@@ -414,9 +416,7 @@ export class TalerCorebankApiClient {
     // FIXME: We don't check the status here!
   }
 
-  async abortWithdrawalOperation(
-    wopi: WithdrawalOperationInfo,
-  ): Promise<void> {
+  async abortWithdrawalOperation(wopi: WithdrawalOperationInfo): Promise<void> 
{
     const url = new URL(
       `withdrawals/${wopi.withdrawal_id}/abort`,
       this.baseUrl,
diff --git a/packages/taler-wallet-core/src/operations/pay-peer-push-debit.ts 
b/packages/taler-wallet-core/src/operations/pay-peer-push-debit.ts
index 4c0292cc6..a11ffe774 100644
--- a/packages/taler-wallet-core/src/operations/pay-peer-push-debit.ts
+++ b/packages/taler-wallet-core/src/operations/pay-peer-push-debit.ts
@@ -562,6 +562,7 @@ async function processPeerPushDebitReady(
         };
       }
     } else if (resp.status === HttpStatusCode.Gone) {
+      logger.info(`purse ${pursePub} is gone, aborting peer-push-debit`);
       const transitionInfo = await ws.db
         .mktx((x) => [
           x.peerPushDebit,

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