summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-03-06 11:38:09 +0100
committerFlorian Dold <florian@dold.me>2024-03-06 11:38:09 +0100
commita040c25411285729ae650dbbbf12659f4cb3d215 (patch)
treed9b7af4e1589e90169876b053453521e2cb36ba2
parent541886750eb1bc32b9aa0323868dd24776baf0eb (diff)
downloadwallet-core-dev/dold/tos-check.tar.gz
wallet-core-dev/dold/tos-check.tar.bz2
wallet-core-dev/dold/tos-check.zip
towards tos checkdev/dold/tos-check
-rw-r--r--packages/taler-harness/src/harness/harness.ts22
-rw-r--r--packages/taler-harness/src/integrationtests/test-wallet-refresh.ts2
-rw-r--r--packages/taler-harness/src/integrationtests/test-wallet-tos.ts32
-rw-r--r--packages/taler-harness/src/integrationtests/testrunner.ts2
4 files changed, 56 insertions, 2 deletions
diff --git a/packages/taler-harness/src/harness/harness.ts b/packages/taler-harness/src/harness/harness.ts
index 291cd4c6d..72e2c9d46 100644
--- a/packages/taler-harness/src/harness/harness.ts
+++ b/packages/taler-harness/src/harness/harness.ts
@@ -1052,7 +1052,8 @@ export class ExchangeService implements ExchangeServiceInterface {
static create(gc: GlobalTestState, e: ExchangeConfig) {
const testDir = e.overrideTestDir ?? gc.testDir;
const config = new Configuration();
- setTalerPaths(config, `${testDir}/talerhome-exchange-${e.name}`, e.name);
+ const exchangeHome = `${testDir}/talerhome-exchange-${e.name}`;
+ setTalerPaths(config, exchangeHome, e.name);
config.setString("taler", "currency", e.currency);
// Required by the exchange but not really used yet.
config.setString("exchange", "aml_threshold", `${e.currency}:1000000`);
@@ -1111,6 +1112,25 @@ export class ExchangeService implements ExchangeServiceInterface {
fs.writeFileSync(masterPrivFile, Buffer.from(exchangeMasterKey.eddsaPriv));
+ const setupTerms = true;
+
+ if (setupTerms) {
+ const termsEtag = "exchange-terms-v42";
+ const termsDir = config.getPath("exchange", "terms_dir").required();
+ config.setString("exchange", "TERMS_DIR", "${TALER_DATA_HOME}/terms");
+ config.setString("exchange", "TERMS_ETAG", termsEtag);
+ fs.mkdirSync(`${termsDir}/en`);
+ // Generate some mock ToS
+ fs.writeFileSync(
+ `${termsDir}/en/${termsEtag}.txt`,
+ "TEST-TERMS-CONTENT-TXT",
+ );
+ fs.writeFileSync(
+ `${termsDir}/en/${termsEtag}.pdf`,
+ "TEST-TERMS-CONTENT-PDF",
+ );
+ }
+
const cfgFilename = testDir + `/exchange-${e.name}.conf`;
config.write(cfgFilename, { excludeDefaults: true });
return new ExchangeService(gc, e, cfgFilename, exchangeMasterKey);
diff --git a/packages/taler-harness/src/integrationtests/test-wallet-refresh.ts b/packages/taler-harness/src/integrationtests/test-wallet-refresh.ts
index f1c544a4e..38f756f29 100644
--- a/packages/taler-harness/src/integrationtests/test-wallet-refresh.ts
+++ b/packages/taler-harness/src/integrationtests/test-wallet-refresh.ts
@@ -37,7 +37,7 @@ import {
} from "../harness/helpers.js";
/**
- * Run test for refreshe after a payment.
+ * Run test for refresh after a payment.
*/
export async function runWalletRefreshTest(t: GlobalTestState) {
// Set up test environment
diff --git a/packages/taler-harness/src/integrationtests/test-wallet-tos.ts b/packages/taler-harness/src/integrationtests/test-wallet-tos.ts
new file mode 100644
index 000000000..89a2ccbcd
--- /dev/null
+++ b/packages/taler-harness/src/integrationtests/test-wallet-tos.ts
@@ -0,0 +1,32 @@
+/*
+ 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/>
+ */
+
+/**
+ * Imports.
+ */
+import { GlobalTestState } from "../harness/harness.js";
+import { createSimpleTestkudosEnvironmentV2 } from "../harness/helpers.js";
+
+export async function runWalletTosTest(t: GlobalTestState) {
+ // Set up test environment
+
+ const { walletClient, bank, exchange, merchant } =
+ await createSimpleTestkudosEnvironmentV2(t);
+
+
+}
+
+runWalletTosTest.suites = ["wallet"];
diff --git a/packages/taler-harness/src/integrationtests/testrunner.ts b/packages/taler-harness/src/integrationtests/testrunner.ts
index 803e68e6b..cc35b337c 100644
--- a/packages/taler-harness/src/integrationtests/testrunner.ts
+++ b/packages/taler-harness/src/integrationtests/testrunner.ts
@@ -99,6 +99,7 @@ import { runWalletGenDbTest } from "./test-wallet-gendb.js";
import { runWalletNotificationsTest } from "./test-wallet-notifications.js";
import { runWalletObservabilityTest } from "./test-wallet-observability.js";
import { runWalletRefreshTest } from "./test-wallet-refresh.js";
+import { runWalletTosTest } from "./test-wallet-tos.js";
import { runWallettestingTest } from "./test-wallettesting.js";
import { runWithdrawalAbortBankTest } from "./test-withdrawal-abort-bank.js";
import { runWithdrawalBankIntegratedTest } from "./test-withdrawal-bank-integrated.js";
@@ -204,6 +205,7 @@ const allTests: TestMainFunction[] = [
runWalletObservabilityTest,
runWalletDevExperimentsTest,
runWalletBalanceZeroTest,
+ runWalletTosTest,
];
export interface TestRunSpec {