diff options
author | Florian Dold <florian@dold.me> | 2023-09-06 10:48:44 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-09-06 10:48:44 +0200 |
commit | da4f3900b4ef8dda2070af567f66d8f668b4eb2f (patch) | |
tree | b70298eb847307ae9cba89e0bc22df302c10f6ae /packages/taler-harness/src/integrationtests | |
parent | 665c42f595151650bb87a3108a19d6df67ed6324 (diff) | |
download | wallet-core-da4f3900b4ef8dda2070af567f66d8f668b4eb2f.tar.xz |
harness: check idempotency of merchant account creation API
Diffstat (limited to 'packages/taler-harness/src/integrationtests')
4 files changed, 34 insertions, 21 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-age-restrictions-merchant.ts b/packages/taler-harness/src/integrationtests/test-age-restrictions-merchant.ts index 5ee35a377..3072badc0 100644 --- a/packages/taler-harness/src/integrationtests/test-age-restrictions-merchant.ts +++ b/packages/taler-harness/src/integrationtests/test-age-restrictions-merchant.ts @@ -82,13 +82,14 @@ export async function runAgeRestrictionsMerchantTest(t: GlobalTestState) { name: "w0", }); - await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV2(t, { walletClient: walletClientZero, bank, exchange, amount: "TESTKUDOS:20", restrictAge: 13, }); + await wres.withdrawalFinishedCond; const order = { summary: "Buy me!", @@ -111,13 +112,14 @@ export async function runAgeRestrictionsMerchantTest(t: GlobalTestState) { { const walletClient = walletClientOne; - await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV2(t, { walletClient, bank, exchange, amount: "TESTKUDOS:20", restrictAge: 13, }); + await wres.withdrawalFinishedCond; const order = { summary: "Buy me!", @@ -136,13 +138,14 @@ export async function runAgeRestrictionsMerchantTest(t: GlobalTestState) { { const walletClient = walletClientTwo; - await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV2(t, { walletClient, bank, exchange, amount: "TESTKUDOS:20", restrictAge: 13, }); + await wres.withdrawalFinishedCond; const order = { summary: "Buy me!", @@ -160,12 +163,13 @@ export async function runAgeRestrictionsMerchantTest(t: GlobalTestState) { { const walletClient = walletClientThree; - await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV2(t, { walletClient, bank, exchange, amount: "TESTKUDOS:20", }); + await wres.withdrawalFinishedCond; const order = { summary: "Buy me!", diff --git a/packages/taler-harness/src/integrationtests/test-bank-api.ts b/packages/taler-harness/src/integrationtests/test-bank-api.ts index 041b10cc0..e645d60f1 100644 --- a/packages/taler-harness/src/integrationtests/test-bank-api.ts +++ b/packages/taler-harness/src/integrationtests/test-bank-api.ts @@ -84,12 +84,6 @@ export async function runBankApiTest(t: GlobalTestState) { await merchant.start(); await merchant.pingUntilAvailable(); - await merchant.addDefaultInstance(); - await merchant.addInstanceWithWireAccount({ - id: "minst1", - name: "minst1", - paytoUris: [getPayto("minst1")], - }); await merchant.addInstanceWithWireAccount({ id: "default", @@ -97,6 +91,12 @@ export async function runBankApiTest(t: GlobalTestState) { paytoUris: [getPayto("merchant-default")], }); + await merchant.addInstanceWithWireAccount({ + id: "minst1", + name: "minst1", + paytoUris: [getPayto("minst1")], + }); + console.log("setup done!"); const bankUser = await BankApi.registerAccount(bank, "user1", "pw1", {}); diff --git a/packages/taler-harness/src/integrationtests/test-libeufin-basic.ts b/packages/taler-harness/src/integrationtests/test-libeufin-basic.ts index 5d5beb06e..20fa34437 100644 --- a/packages/taler-harness/src/integrationtests/test-libeufin-basic.ts +++ b/packages/taler-harness/src/integrationtests/test-libeufin-basic.ts @@ -19,12 +19,12 @@ */ import { AbsoluteTime, - MerchantContractTerms, Duration, + MerchantContractTerms, } from "@gnu-taler/taler-util"; import { - WalletApiOperation, HarnessExchangeBankAccount, + WalletApiOperation, } from "@gnu-taler/taler-wallet-core"; import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js"; import { @@ -32,20 +32,19 @@ import { ExchangeService, GlobalTestState, MerchantService, - setupDb, - WalletCli, WalletClient, + setupDb, } from "../harness/harness.js"; import { + createWalletDaemonWithClient, + makeTestPaymentV2, +} from "../harness/helpers.js"; +import { LibeufinNexusApi, LibeufinNexusService, LibeufinSandboxApi, LibeufinSandboxService, } from "../harness/libeufin.js"; -import { - createWalletDaemonWithClient, - makeTestPaymentV2, -} from "../harness/helpers.js"; const exchangeIban = "DE71500105179674997361"; const customerIban = "DE84500105176881385584"; @@ -73,7 +72,7 @@ export async function createLibeufinTestEnvironment( const libeufinSandbox = await LibeufinSandboxService.create(t, { httpPort: 5010, - databaseJdbcUri: `jdbc:sqlite:${t.testDir}/libeufin-sandbox.sqlite3`, + databaseJdbcUri: db.connStr, }); await libeufinSandbox.start(); @@ -81,7 +80,7 @@ export async function createLibeufinTestEnvironment( const libeufinNexus = await LibeufinNexusService.create(t, { httpPort: 5011, - databaseJdbcUri: `jdbc:sqlite:${t.testDir}/libeufin-nexus.sqlite3`, + databaseJdbcUri: db.connStr, }); await libeufinNexus.start(); @@ -218,7 +217,7 @@ export async function createLibeufinTestEnvironment( console.log("setup done!"); const { walletClient } = await createWalletDaemonWithClient(t, { - name: "default ", + name: "default", }); return { diff --git a/packages/taler-harness/src/integrationtests/test-merchant-instances.ts b/packages/taler-harness/src/integrationtests/test-merchant-instances.ts index 167c54cb4..54205e9f2 100644 --- a/packages/taler-harness/src/integrationtests/test-merchant-instances.ts +++ b/packages/taler-harness/src/integrationtests/test-merchant-instances.ts @@ -86,6 +86,16 @@ export async function runMerchantInstancesTest(t: GlobalTestState) { }, }); + // Add it again, should be idempotent + await merchant.addInstanceWithWireAccount({ + id: "default", + name: "Default Instance", + paytoUris: [getPayto("merchant-default")], + auth: { + method: "external", + }, + }); + // Add an instance, no auth! await merchant.addInstanceWithWireAccount({ id: "myinst", |