taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit 16ca230ad87bdb72eb845d29dc9761e86ae31bf2
parent 4dd8a113e923653d4ac9608894df78990c37cf35
Author: Florian Dold <florian@dold.me>
Date:   Fri,  8 May 2026 15:19:56 +0200

harness: remove duplicated test

The merchant-self-provision-activation test already covers login

Diffstat:
Dpackages/taler-harness/src/integrationtests/test-merchant-self-provision-activation-and-login.ts | 194-------------------------------------------------------------------------------
Mpackages/taler-harness/src/integrationtests/testrunner.ts | 6++----
2 files changed, 2 insertions(+), 198 deletions(-)

diff --git a/packages/taler-harness/src/integrationtests/test-merchant-self-provision-activation-and-login.ts b/packages/taler-harness/src/integrationtests/test-merchant-self-provision-activation-and-login.ts @@ -1,194 +0,0 @@ -/* - This file is part of GNU Taler - (C) 2021 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/> - */ - -/** - * Imports. - */ -import { - alternativeOrThrow, - Duration, - HttpStatusCode, - MerchantAuthMethod, - succeedOrThrow, - TalerMerchantInstanceHttpClient, - TalerMerchantManagementHttpClient, - TanChannel, -} from "@gnu-taler/taler-util"; -import { createSimpleTestkudosEnvironmentV3 } from "harness/environments.js"; -import { startTanHelper } from "harness/tan-helper.js"; -import { randomBytes } from "node:crypto"; -import { chmodSync, writeFileSync } from "node:fs"; -import { GlobalTestState } from "../harness/harness.js"; - -/** - * Do basic checks on instance management and authentication. - */ -export async function runMerchantSelfProvisionActivationAndLoginTest( - t: GlobalTestState, -) { - // Set up test environment - - // FIXME: maybe merchant can use commands? - const RND = randomBytes(10).toString("hex"); - const socketFile = `${t.testDir}/tan-helper-${RND}.socket`; - const helperScript = `${t.testDir}/harness-helper-${RND}.sh`; - writeFileSync( - helperScript, - `#!/bin/bash -taler-harness run-helper --socket ${socketFile} -- $@ -`, - ); - chmodSync(helperScript, "777"); - - const { - walletClient, - bankClient, - exchange, - merchant, - bank, - merchantAdminAccessToken, - } = await createSimpleTestkudosEnvironmentV3(t, undefined, { - additionalMerchantConfig(m) { - m.modifyConfig(async (cfg) => { - cfg.setString("merchant", "ENABLE_SELF_PROVISIONING", "yes"); - cfg.setString("merchant", "HELPER_SMS", helperScript); - cfg.setString("merchant", "HELPER_EMAIL", helperScript); - cfg.setString("merchant", "MANDATORY_TAN_CHANNELS", "email sms"); - }); - }, - }); - const helper = await startTanHelper({ socketFile }); - - const merchantClient = new TalerMerchantManagementHttpClient( - merchant.makeInstanceBaseUrl(), - ); - - { - const r = succeedOrThrow( - await merchantClient.listInstances(merchantAdminAccessToken), - ); - t.assertDeepEqual(r.instances.length, 2); - } - - const instanceInfo = { - id: "self-instance", - name: "My instance", - auth: { - method: MerchantAuthMethod.TOKEN, - password: "123", - }, - default_pay_delay: Duration.toTalerProtocolDuration( - Duration.fromSpec({ days: 14 }), - ), - default_wire_transfer_delay: Duration.toTalerProtocolDuration( - Duration.fromSpec({ - days: 7, - }), - ), - jurisdiction: {}, - address: {}, - email: "some@taler.net", - phone_number: "+1111", - use_stefan: false, - }; - const loginTokenDuration = Duration.fromSpec({ months: 6 }); - const signupStart = alternativeOrThrow( - await merchantClient.createInstanceSelfProvision(instanceInfo, { - tokenValidity: loginTokenDuration, - }), - HttpStatusCode.Accepted, - ); - - // creation requires 2fa - t.assertDeepEqual(signupStart.challenges.length, 2); - t.assertDeepEqual(signupStart.combi_and, true); - - const firstChallenge = signupStart.challenges[0]; - const secondChallenge = signupStart.challenges[1]; - - //FIXME: check the order - // always first emails since is cheaper - t.assertTrue(firstChallenge.tan_channel === TanChannel.EMAIL); - t.assertTrue(secondChallenge.tan_channel === TanChannel.SMS); - - { - // new instance is pending, then is not listed - const r = succeedOrThrow( - await merchantClient.listInstances(merchantAdminAccessToken), - ); - t.assertDeepEqual(r.instances.length, 2); - } - - { - succeedOrThrow( - await merchantClient.sendChallenge(firstChallenge.challenge_id), - ); - - const message = helper.getLastCodeForAddress(instanceInfo.phone_number); - const [tanCode] = message.split("\n"); - succeedOrThrow( - await merchantClient.confirmChallenge(firstChallenge.challenge_id, { - tan: tanCode, - }), - ); - } - - { - succeedOrThrow( - await merchantClient.sendChallenge(secondChallenge.challenge_id), - ); - - const message = helper.getLastCodeForAddress(instanceInfo.email); - const [tanCode] = message.split("\n"); - succeedOrThrow( - await merchantClient.confirmChallenge(secondChallenge.challenge_id, { - tan: tanCode, - }), - ); - } - - const completeSignup = succeedOrThrow( - await merchantClient.createInstanceSelfProvision(instanceInfo, { - tokenValidity: loginTokenDuration, - challengeIds: [firstChallenge.challenge_id, secondChallenge.challenge_id], - }), - ); - - t.assertTrue(completeSignup !== null); - - const instanceApi = new TalerMerchantInstanceHttpClient( - merchantClient.getSubInstanceAPI(instanceInfo.id), - merchantClient.httpLib, - ); - - const { access_token: token } = completeSignup!; - const det = succeedOrThrow( - await instanceApi.getCurrentInstanceDetails(token), - ); - - // check that the instance has the new email - t.assertDeepEqual(det.email, instanceInfo.email); - t.assertDeepEqual(det.email_validated, true); - t.assertDeepEqual(det.phone_number, instanceInfo.phone_number); - t.assertDeepEqual(det.phone_validated, true); - - helper.stop(); -} - -runMerchantSelfProvisionActivationAndLoginTest.suites = [ - "merchant", - "self-provision", -]; diff --git a/packages/taler-harness/src/integrationtests/testrunner.ts b/packages/taler-harness/src/integrationtests/testrunner.ts @@ -117,7 +117,6 @@ import { runMerchantLongpollingTest } from "./test-merchant-longpolling.js"; import { runMerchantPaytoReuseTest } from "./test-merchant-payto-reuse.js"; import { runMerchantRefundApiTest } from "./test-merchant-refund-api.js"; import { runMerchantReportsTest } from "./test-merchant-reports.js"; -import { runMerchantSelfProvisionActivationAndLoginTest } from "./test-merchant-self-provision-activation-and-login.js"; import { runMerchantSelfProvisionActivationTwoBankAccountsTest } from "./test-merchant-self-provision-activation-two-bank-account.js"; import { runMerchantSelfProvisionActivationTest } from "./test-merchant-self-provision-activation.js"; import { runMerchantSelfProvisionForgotPasswordTest } from "./test-merchant-self-provision-forgot-password.js"; @@ -126,6 +125,8 @@ import { runMerchantSpecPublicOrdersTest } from "./test-merchant-spec-public-ord import { runMerchantWireTest } from "./test-merchant-wire.js"; import { runMultiExchangeTest } from "./test-multiexchange.js"; import { runOtpTest } from "./test-otp.js"; +import { runPaivanaRepurchaseTest } from "./test-paivana-repurchase.js"; +import { runPaivanaTest } from "./test-paivana.js"; import { runPayPaidTest } from "./test-pay-paid.js"; import { runPaymentAbortTest } from "./test-payment-abort.js"; import { runPaymentClaimTest } from "./test-payment-claim.js"; @@ -224,8 +225,6 @@ import { runWithdrawalHugeTest } from "./test-withdrawal-huge.js"; import { runWithdrawalIdempotentTest } from "./test-withdrawal-idempotent.js"; import { runWithdrawalManualTest } from "./test-withdrawal-manual.js"; import { runWithdrawalPrepareTest } from "./test-withdrawal-prepare.js"; -import { runPaivanaTest } from "./test-paivana.js"; -import { runPaivanaRepurchaseTest } from "./test-paivana-repurchase.js"; /** * Test runner. @@ -342,7 +341,6 @@ const allTests: TestMainFunction[] = [ runMerchantSelfProvisionActivationTest, runMerchantSelfProvisionActivationTwoBankAccountsTest, runWebMerchantLoginTest, - runMerchantSelfProvisionActivationAndLoginTest, runMerchantSelfProvisionForgotPasswordTest, runMerchantSelfProvisionInactiveAccountPermissionsTest, runWithdrawalExternalTest,