From 825d2c4352022e7397854b2bd9ba7d3589873c07 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 15 Feb 2023 23:32:42 +0100 Subject: make wallet-cli runnable under qtart --- .../src/integrationtests/test-exchange-timetravel.ts | 10 +++------- packages/taler-harness/src/integrationtests/test-kyc.ts | 14 +++++++++----- .../integrationtests/test-merchant-spec-public-orders.ts | 5 +++-- .../src/integrationtests/test-payment-on-demo.ts | 4 ++-- .../src/integrationtests/test-wallet-cryptoworker.ts | 13 ------------- .../src/integrationtests/test-wallet-dbless.ts | 11 +++++------ 6 files changed, 22 insertions(+), 35 deletions(-) (limited to 'packages/taler-harness/src/integrationtests') diff --git a/packages/taler-harness/src/integrationtests/test-exchange-timetravel.ts b/packages/taler-harness/src/integrationtests/test-exchange-timetravel.ts index 074126e9f..20285cb6a 100644 --- a/packages/taler-harness/src/integrationtests/test-exchange-timetravel.ts +++ b/packages/taler-harness/src/integrationtests/test-exchange-timetravel.ts @@ -24,22 +24,18 @@ import { Duration, durationFromSpec, } from "@gnu-taler/taler-util"; -import { - NodeHttpLib, - readSuccessResponseJsonOrThrow, -} from "@gnu-taler/taler-wallet-core"; +import { createPlatformHttpLib, readSuccessResponseJsonOrThrow } from "@gnu-taler/taler-util/http"; import { makeNoFeeCoinConfig } from "../harness/denomStructures.js"; import { BankService, ExchangeService, GlobalTestState, - MerchantPrivateApi, MerchantService, setupDb, WalletCli, getPayto, } from "../harness/harness.js"; -import { startWithdrawViaBank, withdrawViaBank } from "../harness/helpers.js"; +import { withdrawViaBank } from "../harness/helpers.js"; async function applyTimeTravel( timetravelDuration: Duration, @@ -69,7 +65,7 @@ async function applyTimeTravel( } } -const http = new NodeHttpLib(); +const http = createPlatformHttpLib(); /** * Basic time travel test. diff --git a/packages/taler-harness/src/integrationtests/test-kyc.ts b/packages/taler-harness/src/integrationtests/test-kyc.ts index 490673cee..915c3d470 100644 --- a/packages/taler-harness/src/integrationtests/test-kyc.ts +++ b/packages/taler-harness/src/integrationtests/test-kyc.ts @@ -17,11 +17,14 @@ /** * Imports. */ -import { Duration, j2s, NotificationType } from "@gnu-taler/taler-util"; +import { + Duration, + j2s, + NotificationType, +} from "@gnu-taler/taler-util"; import { BankAccessApi, BankApi, - NodeHttpLib, WalletApiOperation, } from "@gnu-taler/taler-wallet-core"; import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js"; @@ -37,6 +40,7 @@ import { } from "../harness/harness.js"; import { EnvOptions, SimpleTestEnvironmentNg } from "../harness/helpers.js"; import * as http from "node:http"; +import { createPlatformHttpLib } from "@gnu-taler/taler-util/http"; export async function createKycTestkudosEnvironment( t: GlobalTestState, @@ -336,12 +340,12 @@ export async function runKycTest(t: GlobalTestState) { // We now simulate the user interacting with the KYC service, // which would usually done in the browser. - const httpClient = new NodeHttpLib(); - const kycServerResp = await httpClient.get(kycNotif.kycUrl); + const httpLib = createPlatformHttpLib(); + const kycServerResp = await httpLib.get(kycNotif.kycUrl); const kycLoginResp = await kycServerResp.json(); console.log("kyc server resp:", j2s(kycLoginResp)); const kycProofUrl = kycLoginResp.redirect_uri; - const proofHttpResp = await httpClient.get(kycProofUrl); + const proofHttpResp = await httpLib.get(kycProofUrl); console.log("proof resp status", proofHttpResp.status); console.log("resp headers", proofHttpResp.headers.toJSON()); diff --git a/packages/taler-harness/src/integrationtests/test-merchant-spec-public-orders.ts b/packages/taler-harness/src/integrationtests/test-merchant-spec-public-orders.ts index 70edaaf0c..2fafe7584 100644 --- a/packages/taler-harness/src/integrationtests/test-merchant-spec-public-orders.ts +++ b/packages/taler-harness/src/integrationtests/test-merchant-spec-public-orders.ts @@ -24,7 +24,8 @@ import { encodeCrock, getRandomBytes, } from "@gnu-taler/taler-util"; -import { NodeHttpLib, WalletApiOperation } from "@gnu-taler/taler-wallet-core"; +import { createPlatformHttpLib } from "@gnu-taler/taler-util/http"; +import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { BankService, ExchangeService, @@ -38,7 +39,7 @@ import { withdrawViaBank, } from "../harness/helpers.js"; -const httpLib = new NodeHttpLib(); +const httpLib = createPlatformHttpLib(); interface Context { merchant: MerchantService; diff --git a/packages/taler-harness/src/integrationtests/test-payment-on-demo.ts b/packages/taler-harness/src/integrationtests/test-payment-on-demo.ts index 737620ce7..22e88c8a0 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-on-demo.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-on-demo.ts @@ -24,8 +24,8 @@ import { BankApi, BankAccessApi, BankServiceHandle, - NodeHttpLib, } from "@gnu-taler/taler-wallet-core"; +import { createPlatformHttpLib } from "@gnu-taler/taler-util/http"; /** * Run test for basic, bank-integrated withdrawal and payment. @@ -35,7 +35,7 @@ export async function runPaymentDemoTest(t: GlobalTestState) { let bankInterface: BankServiceHandle = { baseUrl: "https://bank.demo.taler.net/", bankAccessApiBaseUrl: "https://bank.demo.taler.net/", - http: new NodeHttpLib(), + http: createPlatformHttpLib(), }; let user = await BankApi.createRandomBankUser(bankInterface); let wop = await BankAccessApi.createWithdrawalOperation( diff --git a/packages/taler-harness/src/integrationtests/test-wallet-cryptoworker.ts b/packages/taler-harness/src/integrationtests/test-wallet-cryptoworker.ts index a9f1c4d80..6c2006636 100644 --- a/packages/taler-harness/src/integrationtests/test-wallet-cryptoworker.ts +++ b/packages/taler-harness/src/integrationtests/test-wallet-cryptoworker.ts @@ -17,23 +17,10 @@ /** * Imports. */ -import { j2s } from "@gnu-taler/taler-util"; import { - checkReserve, - CryptoDispatcher, - depositCoin, - downloadExchangeInfo, - findDenomOrThrow, - NodeHttpLib, - refreshCoin, - SynchronousCryptoWorkerFactoryNode, - TalerError, - topupReserveWithDemobank, WalletApiOperation, - withdrawCoin, } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState, WalletCli } from "../harness/harness.js"; -import { createSimpleTestkudosEnvironment } from "../harness/helpers.js"; /** * Run test for the different crypto workers. diff --git a/packages/taler-harness/src/integrationtests/test-wallet-dbless.ts b/packages/taler-harness/src/integrationtests/test-wallet-dbless.ts index 7692f12b2..08c10fd91 100644 --- a/packages/taler-harness/src/integrationtests/test-wallet-dbless.ts +++ b/packages/taler-harness/src/integrationtests/test-wallet-dbless.ts @@ -17,17 +17,16 @@ /** * Imports. */ -import { j2s } from "@gnu-taler/taler-util"; +import { j2s, TalerError } from "@gnu-taler/taler-util"; +import { createPlatformHttpLib } from "@gnu-taler/taler-util/http"; import { checkReserve, CryptoDispatcher, depositCoin, downloadExchangeInfo, findDenomOrThrow, - NodeHttpLib, refreshCoin, - SynchronousCryptoWorkerFactoryNode, - TalerError, + SynchronousCryptoWorkerFactoryPlain, topupReserveWithDemobank, withdrawCoin, } from "@gnu-taler/taler-wallet-core"; @@ -42,9 +41,9 @@ export async function runWalletDblessTest(t: GlobalTestState) { const { bank, exchange } = await createSimpleTestkudosEnvironment(t); - const http = new NodeHttpLib(); + const http = createPlatformHttpLib(); const cryptiDisp = new CryptoDispatcher( - new SynchronousCryptoWorkerFactoryNode(), + new SynchronousCryptoWorkerFactoryPlain(), ); const cryptoApi = cryptiDisp.cryptoApi; -- cgit v1.2.3