commit da9fbd8e2565b2b8c031240c51f51993b0c2363f
parent edf4ee60b66cd60ab0d7d7d0fb2d6fae5b2e60b1
Author: Florian Dold <florian@dold.me>
Date: Wed, 28 Aug 2024 17:41:37 +0200
harness: integration test for new_measure
Diffstat:
2 files changed, 50 insertions(+), 0 deletions(-)
diff --git a/packages/taler-harness/src/harness/helpers.ts b/packages/taler-harness/src/harness/helpers.ts
@@ -32,6 +32,7 @@ import {
Duration,
encodeCrock,
HttpStatusCode,
+ LegitimizationRuleSet,
Logger,
MerchantApiClient,
NotificationType,
@@ -1039,3 +1040,50 @@ export async function postAmlDecisionNoRules(
t.assertDeepEqual(resp.status, HttpStatusCode.NoContent);
}
+
+/**
+ * Post an AML decision that no rules shall apply for the given account.
+ */
+export async function postAmlDecision(
+ t: GlobalTestState,
+ req: {
+ exchangeBaseUrl: string;
+ paytoHash: string;
+ amlPriv: string;
+ amlPub: string;
+ newRules: LegitimizationRuleSet;
+ newMeasure?: string | undefined;
+ },
+) {
+ const { exchangeBaseUrl, paytoHash, amlPriv, amlPub } = req;
+
+ const sigData: AmlDecisionRequestWithoutSignature = {
+ decision_time: TalerProtocolTimestamp.now(),
+ h_payto: paytoHash,
+ justification: "Bla",
+ keep_investigating: false,
+ new_rules: req.newRules,
+ new_measure: req.newMeasure,
+ properties: {
+ foo: "42",
+ },
+ };
+
+ const sig = signAmlDecision(decodeCrock(amlPriv), sigData);
+
+ const reqBody: AmlDecisionRequest = {
+ ...sigData,
+ officer_sig: encodeCrock(sig),
+ };
+
+ const reqUrl = new URL(`aml/${amlPub}/decision`, exchangeBaseUrl);
+
+ const resp = await harnessHttpLib.fetch(reqUrl.href, {
+ method: "POST",
+ body: reqBody,
+ });
+
+ console.log(`aml decision status: ${resp.status}`);
+
+ t.assertDeepEqual(resp.status, HttpStatusCode.NoContent);
+}
diff --git a/packages/taler-harness/src/integrationtests/testrunner.ts b/packages/taler-harness/src/integrationtests/testrunner.ts
@@ -51,6 +51,7 @@ import { runKycBalanceWithdrawalTest } from "./test-kyc-balance-withdrawal.js";
import { runKycDepositAggregateTest } from "./test-kyc-deposit-aggregate.js";
import { runKycExchangeWalletTest } from "./test-kyc-exchange-wallet.js";
import { runKycFormWithdrawalTest } from "./test-kyc-form-withdrawal.js";
+import { runKycNewMeasureTest } from "./test-kyc-new-measure.js";
import { runKycPeerPullTest } from "./test-kyc-peer-pull.js";
import { runKycPeerPushTest } from "./test-kyc-peer-push.js";
import { runKycThresholdWithdrawalTest } from "./test-kyc-threshold-withdrawal.js";
@@ -258,6 +259,7 @@ const allTests: TestMainFunction[] = [
runKycDepositAggregateTest,
runKycFormWithdrawalTest,
runKycBalanceWithdrawalTest,
+ runKycNewMeasureTest,
];
export interface TestRunSpec {