[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] branch master updated: harness: adjust tests to new
From: |
gnunet |
Subject: |
[taler-wallet-core] branch master updated: harness: adjust tests to new kyc config constraints (continued) |
Date: |
Wed, 08 Jan 2025 18:26:37 +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 e1d53718d harness: adjust tests to new kyc config constraints
(continued)
e1d53718d is described below
commit e1d53718d3d3f9203a2abcba536f7a1823b9ed32
Author: Florian Dold <florian@dold.me>
AuthorDate: Wed Jan 8 18:26:33 2025 +0100
harness: adjust tests to new kyc config constraints (continued)
---
.../test-kyc-threshold-withdrawal.ts | 63 +++++++-------
.../src/integrationtests/test-kyc-two-forms.ts | 95 +++++++---------------
.../test-kyc-withdrawal-verboten.ts | 1 -
3 files changed, 59 insertions(+), 100 deletions(-)
diff --git
a/packages/taler-harness/src/integrationtests/test-kyc-threshold-withdrawal.ts
b/packages/taler-harness/src/integrationtests/test-kyc-threshold-withdrawal.ts
index ad602fc3a..c6f8c329b 100644
---
a/packages/taler-harness/src/integrationtests/test-kyc-threshold-withdrawal.ts
+++
b/packages/taler-harness/src/integrationtests/test-kyc-threshold-withdrawal.ts
@@ -18,6 +18,7 @@
* Imports.
*/
import {
+ Configuration,
NotificationType,
TransactionMajorState,
TransactionMinorState,
@@ -25,48 +26,46 @@ import {
} from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import {
+ configureCommonKyc,
createKycTestkudosEnvironment,
postAmlDecisionNoRules,
} from "../harness/environments.js";
import { GlobalTestState } from "../harness/harness.js";
+function adjustExchangeConfig(config: Configuration): void {
+ configureCommonKyc(config);
+
+ config.setString("KYC-RULE-R1", "operation_type", "withdraw");
+ config.setString("KYC-RULE-R1", "enabled", "yes");
+ config.setString("KYC-RULE-R1", "exposed", "yes");
+ config.setString("KYC-RULE-R1", "is_and_combinator", "yes");
+ config.setString("KYC-RULE-R1", "threshold", "TESTKUDOS:5");
+ config.setString("KYC-RULE-R1", "timeframe", "1d");
+ config.setString("KYC-RULE-R1", "next_measures", "M1");
+
+ config.setString("KYC-RULE-R2", "operation_type", "withdraw");
+ config.setString("KYC-RULE-R2", "enabled", "yes");
+ config.setString("KYC-RULE-R2", "exposed", "yes");
+ config.setString("KYC-RULE-R2", "is_and_combinator", "yes");
+ config.setString("KYC-RULE-R2", "threshold", "TESTKUDOS:300");
+ config.setString("KYC-RULE-R2", "timeframe", "1d");
+ config.setString("KYC-RULE-R2", "next_measures", "verboten");
+
+ config.setString("KYC-MEASURE-M1", "check_name", "C1");
+ config.setString("KYC-MEASURE-M1", "context", "{}");
+ config.setString("KYC-MEASURE-M1", "program", "NONE");
+
+ config.setString("KYC-CHECK-C1", "type", "INFO");
+ config.setString("KYC-CHECK-C1", "description", "my check!");
+ config.setString("KYC-CHECK-C1", "fallback", "FREEZE");
+}
+
export async function runKycThresholdWithdrawalTest(t: GlobalTestState) {
// Set up test environment
const { walletClient, bankClient, exchange, amlKeypair } =
await createKycTestkudosEnvironment(t, {
- adjustExchangeConfig(config) {
- config.setString("exchange", "enable_kyc", "yes");
-
- config.setString("KYC-RULE-R1", "operation_type", "withdraw");
- config.setString("KYC-RULE-R1", "enabled", "yes");
- config.setString("KYC-RULE-R1", "exposed", "yes");
- config.setString("KYC-RULE-R1", "is_and_combinator", "yes");
- config.setString("KYC-RULE-R1", "threshold", "TESTKUDOS:5");
- config.setString("KYC-RULE-R1", "timeframe", "1d");
- config.setString("KYC-RULE-R1", "next_measures", "M1");
-
- config.setString("KYC-RULE-R2", "operation_type", "withdraw");
- config.setString("KYC-RULE-R2", "enabled", "yes");
- config.setString("KYC-RULE-R2", "exposed", "yes");
- config.setString("KYC-RULE-R2", "is_and_combinator", "yes");
- config.setString("KYC-RULE-R2", "threshold", "TESTKUDOS:300");
- config.setString("KYC-RULE-R2", "timeframe", "1d");
- config.setString("KYC-RULE-R2", "next_measures", "verboten");
-
- config.setString("KYC-MEASURE-M1", "check_name", "C1");
- config.setString("KYC-MEASURE-M1", "context", "{}");
- config.setString("KYC-MEASURE-M1", "program", "P1");
-
- config.setString("AML-PROGRAM-P1", "command", "/bin/true");
- config.setString("AML-PROGRAM-P1", "enabled", "true");
- config.setString("AML-PROGRAM-P1", "description", "this does nothing");
- config.setString("AML-PROGRAM-P1", "fallback", "M1");
-
- config.setString("KYC-CHECK-C1", "type", "INFO");
- config.setString("KYC-CHECK-C1", "description", "my check!");
- config.setString("KYC-CHECK-C1", "fallback", "M1");
- },
+ adjustExchangeConfig,
});
// Withdraw digital cash into the wallet.
diff --git a/packages/taler-harness/src/integrationtests/test-kyc-two-forms.ts
b/packages/taler-harness/src/integrationtests/test-kyc-two-forms.ts
index b8b57f369..601365916 100644
--- a/packages/taler-harness/src/integrationtests/test-kyc-two-forms.ts
+++ b/packages/taler-harness/src/integrationtests/test-kyc-two-forms.ts
@@ -18,38 +18,25 @@
* Imports.
*/
import {
- AbsoluteTime,
AmountString,
amountToBuffer,
buildSigPS,
codecForAccountKycStatus,
- codecForAny,
codecForKycProcessClientInformation,
codecForLegitimizationNeededResponse,
codecOptional,
Configuration,
createNewWalletKycAccount,
- decodeCrock,
eddsaSign,
encodeCrock,
j2s,
Logger,
- signAmlQuery,
TalerKycAml,
- TalerProtocolTimestamp,
TalerSignaturePurpose,
- TransactionIdStr,
- TransactionMajorState,
- TransactionMinorState,
WalletKycRequest,
} from "@gnu-taler/taler-util";
import { readResponseJsonOrThrow } from "@gnu-taler/taler-util/http";
-import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
-import {
- createKycTestkudosEnvironment,
- postAmlDecision,
- withdrawViaBankV3,
-} from "../harness/environments.js";
+import { configureCommonKyc, createKycTestkudosEnvironment } from
"../harness/environments.js";
import { GlobalTestState, harnessHttpLib, waitMs } from
"../harness/harness.js";
const logger = new Logger("test-kyc-two-forms.ts");
@@ -78,15 +65,7 @@ export const AML_PROGRAM_NEXT_MEASURE_FORM:
TalerKycAml.AmlProgramDefinition = {
};
function adjustExchangeConfig(config: Configuration) {
- config.setString("exchange", "enable_kyc", "yes");
-
- // config.setString("KYC-RULE-R1", "operation_type", "withdraw");
- // config.setString("KYC-RULE-R1", "enabled", "yes");
- // config.setString("KYC-RULE-R1", "exposed", "yes");
- // config.setString("KYC-RULE-R1", "is_and_combinator", "no");
- // config.setString("KYC-RULE-R1", "threshold", "TESTKUDOS:5");
- // config.setString("KYC-RULE-R1", "timeframe", "1d");
- // config.setString("KYC-RULE-R1", "next_measures", "M1");
+ configureCommonKyc(config);
config.setString("KYC-RULE-R1", "operation_type", "balance");
config.setString("KYC-RULE-R1", "enabled", "yes");
@@ -102,19 +81,15 @@ function adjustExchangeConfig(config: Configuration) {
config.setString("KYC-MEASURE-M2", "check_name", "C2");
config.setString("KYC-MEASURE-M2", "context", "{}");
- config.setString("KYC-MEASURE-M2", "program", "P2");
+ config.setString("KYC-MEASURE-M2", "program", "NONE");
config.setString("KYC-MEASURE-M3", "check_name", "C3");
config.setString("KYC-MEASURE-M3", "context", "{}");
- config.setString("KYC-MEASURE-M3", "program", "NOP");
+ config.setString("KYC-MEASURE-M3", "program", "NONE");
config.setString("KYC-MEASURE-M4", "check_name", "C4");
config.setString("KYC-MEASURE-M4", "context", "{}");
- config.setString("KYC-MEASURE-M4", "program", "NOP");
-
- config.setString("KYC-MEASURE-MF", "check_name", "SKIP");
- config.setString("KYC-MEASURE-MF", "context", "{}");
- config.setString("KYC-MEASURE-MF", "program", "NOP");
+ config.setString("KYC-MEASURE-M4", "program", "NONE");
config.setString(
"AML-PROGRAM-P1",
@@ -124,37 +99,21 @@ function adjustExchangeConfig(config: Configuration) {
config.setString("AML-PROGRAM-P1", "enabled", "true");
config.setString("AML-PROGRAM-P1", "description", "remove all rules");
config.setString("AML-PROGRAM-P1", "description_i18n", "{}");
- config.setString("AML-PROGRAM-P1", "fallback", "M1");
-
- config.setString("AML-PROGRAM-P2", "command", "/bin/true");
- config.setString("AML-PROGRAM-P2", "enabled", "true");
- config.setString("AML-PROGRAM-P2", "description", "does nothing");
- config.setString("AML-PROGRAM-P2", "description_i18n", "{}");
- config.setString("AML-PROGRAM-P2", "fallback", "M1");
-
- config.setString("AML-PROGRAM-NOP", "command", "/bin/true");
- config.setString("AML-PROGRAM-NOP", "enabled", "true");
- config.setString(
- "AML-PROGRAM-NOP",
- "description",
- "does nothing (never used)",
- );
- config.setString("AML-PROGRAM-NOP", "description_i18n", "{}");
- config.setString("AML-PROGRAM-NOP", "fallback", "MF");
+ config.setString("AML-PROGRAM-P1", "fallback", "FREEZE");
config.setString("KYC-CHECK-C1", "type", "FORM");
config.setString("KYC-CHECK-C1", "form_name", "firstForm");
config.setString("KYC-CHECK-C1", "description", "starting check!");
config.setString("KYC-CHECK-C1", "description_i18n", "{}");
config.setString("KYC-CHECK-C1", "outputs", "NAME");
- config.setString("KYC-CHECK-C1", "fallback", "MF");
+ config.setString("KYC-CHECK-C1", "fallback", "FREEZE");
config.setString("KYC-CHECK-C2", "type", "FORM");
config.setString("KYC-CHECK-C2", "form_name", "secondForm");
config.setString("KYC-CHECK-C2", "description", "final check!");
config.setString("KYC-CHECK-C2", "description_i18n", "{}");
config.setString("KYC-CHECK-C2", "outputs", "FINAL");
- config.setString("KYC-CHECK-C2", "fallback", "MF");
+ config.setString("KYC-CHECK-C2", "fallback", "FREEZE");
config.setString("KYC-CHECK-C3", "type", "FORM");
config.setString("KYC-CHECK-C3", "form_name", "thirdForm");
@@ -164,7 +123,7 @@ function adjustExchangeConfig(config: Configuration) {
"this is check c3 (never used)",
);
config.setString("KYC-CHECK-C3", "description_i18n", "{}");
- config.setString("KYC-CHECK-C3", "fallback", "MF");
+ config.setString("KYC-CHECK-C3", "fallback", "FREEZE");
config.setString("KYC-CHECK-C4", "type", "FORM");
config.setString("KYC-CHECK-C4", "form_name", "fourthForm");
@@ -174,7 +133,7 @@ function adjustExchangeConfig(config: Configuration) {
"this is check c4 (never used)",
);
config.setString("KYC-CHECK-C4", "description_i18n", "{}");
- config.setString("KYC-CHECK-C4", "fallback", "MF");
+ config.setString("KYC-CHECK-C4", "fallback", "FREEZE");
}
/**
@@ -351,35 +310,37 @@ export async function runKycTwoFormsTest(t:
GlobalTestState) {
// t.assertDeepEqual(infoResp.status, 200);
// t.assertDeepEqual(clientInfo?.requirements.length, 1);
// t.assertDeepEqual(clientInfo?.requirements[0].form, "secondForm");
-
}
}
}
await waitMs(2000);
{
- logger.info("step 6) Check KYC info again after some time, should see the
second form");
- //doing a second request shouldn't fail
- const infoResp = await harnessHttpLib.fetch(
- new URL(`kyc-info/${accessToken}?timeout_ms=1000`, exchange.baseUrl)
- .href,
- );
+ logger.info(
+ "step 6) Check KYC info again after some time, should see the second
form",
+ );
+ //doing a second request shouldn't fail
+ const infoResp = await harnessHttpLib.fetch(
+ new URL(`kyc-info/${accessToken}?timeout_ms=1000`,
exchange.baseUrl).href,
+ );
- const clientInfo = await readResponseJsonOrThrow(
- infoResp,
- codecOptional(codecForKycProcessClientInformation()),
- );
+ const clientInfo = await readResponseJsonOrThrow(
+ infoResp,
+ codecOptional(codecForKycProcessClientInformation()),
+ );
- console.log(j2s(clientInfo));
- t.assertDeepEqual(infoResp.status, 200);
- t.assertDeepEqual(clientInfo?.requirements.length, 1);
- t.assertDeepEqual(clientInfo?.requirements[0].form, "secondForm");
+ console.log(j2s(clientInfo));
+ t.assertDeepEqual(infoResp.status, 200);
+ t.assertDeepEqual(clientInfo?.requirements.length, 1);
+ t.assertDeepEqual(clientInfo?.requirements[0].form, "secondForm");
}
await waitMs(2000);
{
- logger.info("step 6) Check KYC info again after some time, here the
exchange fails");
+ logger.info(
+ "step 6) Check KYC info again after some time, here the exchange fails",
+ );
const infoResp = await harnessHttpLib.fetch(
new URL(`kyc-info/${accessToken}?timeout_ms=1000`,
exchange.baseUrl).href,
);
diff --git
a/packages/taler-harness/src/integrationtests/test-kyc-withdrawal-verboten.ts
b/packages/taler-harness/src/integrationtests/test-kyc-withdrawal-verboten.ts
index 6a440b306..97bfeab0d 100644
---
a/packages/taler-harness/src/integrationtests/test-kyc-withdrawal-verboten.ts
+++
b/packages/taler-harness/src/integrationtests/test-kyc-withdrawal-verboten.ts
@@ -41,7 +41,6 @@ export async function runKycWithdrawalVerbotenTest(t:
GlobalTestState) {
await createKycTestkudosEnvironment(t, {
adjustExchangeConfig(config) {
configureCommonKyc(config);
- config.setString("exchange", "enable_kyc", "yes");
config.setString("KYC-RULE-R1", "operation_type", "withdraw");
config.setString("KYC-RULE-R1", "enabled", "yes");
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-wallet-core] branch master updated: harness: adjust tests to new kyc config constraints (continued),
gnunet <=