diff options
author | ms <ms@taler.net> | 2021-08-18 19:41:39 +0200 |
---|---|---|
committer | ms <ms@taler.net> | 2021-08-18 19:42:17 +0200 |
commit | 739e6576a8f9efc593fc1041de8a7cf73b06f52d (patch) | |
tree | b8bc3f7bb6a6e975e73cd6a7f77c93d1bf40a037 | |
parent | 1d711d441dd0c584f213abf9a97d685b82aafef8 (diff) |
Test Anastasis with user privileges,
therefore giving history permission first.
-rw-r--r-- | packages/taler-wallet-cli/src/integrationtests/test-libeufin-facade-anastasis.ts | 31 | ||||
-rw-r--r-- | packages/taler-wallet-cli/src/integrationtests/test-payment-transient.ts | 2 |
2 files changed, 28 insertions, 5 deletions
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-facade-anastasis.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-facade-anastasis.ts index 48460914b..e559d7e39 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-facade-anastasis.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-facade-anastasis.ts @@ -27,7 +27,7 @@ import { } from "./libeufin"; /** - * Run basic test with LibEuFin. + * Testing the Anastasis API, offered by the Anastasis facade. */ export async function runLibeufinAnastasisFacadeTest(t: GlobalTestState) { /** @@ -46,7 +46,7 @@ export async function runLibeufinAnastasisFacadeTest(t: GlobalTestState) { t, [user01nexus], [user01sandbox], - ["anastasis"], + ["anastasis"], // create only one Anastasis facade. ); let resp = await LibeufinNexusApi.getAllFacades( libeufinServices.libeufinNexus, @@ -63,6 +63,19 @@ export async function runLibeufinAnastasisFacadeTest(t: GlobalTestState) { user01nexus.localAccountName, ); + await LibeufinNexusApi.postPermission( + libeufinServices.libeufinNexus, { + action: "grant", + permission: { + subjectId: user01nexus.userReq.username, + subjectType: "user", + resourceType: "facade", + resourceId: user01nexus.anastasisReq.name, + permissionName: "facade.anastasis.history", + }, + } + ); + // check if empty. let txsEmpty = await LibeufinNexusApi.getAnastasisTransactions( libeufinServices.libeufinNexus, @@ -78,7 +91,7 @@ export async function runLibeufinAnastasisFacadeTest(t: GlobalTestState) { debtorBic: "BCMAESM1XXX", debtorName: "Mock Donor", subject: "Anastasis donation", - amount: "3", // Sandbox takes currency from its "config" + amount: "3", // Sandbox takes currency from its 'config' }, ) @@ -101,9 +114,17 @@ export async function runLibeufinAnastasisFacadeTest(t: GlobalTestState) { let txs = await LibeufinNexusApi.getAnastasisTransactions( libeufinServices.libeufinNexus, - anastasisBaseUrl, {delta: 5}) + anastasisBaseUrl, + {delta: 5}, + user01nexus.userReq.username, + user01nexus.userReq.password, + ); - t.assertTrue(txs.data.incoming_transactions.length == 2); + // check the two payments show up + let txsList = txs.data.incoming_transactions + t.assertTrue(txsList.length == 2); + t.assertTrue([txsList[0].subject, txsList[1].subject].includes("Anastasis donation")); + t.assertTrue([txsList[0].subject, txsList[1].subject].includes("another Anastasis donation")); } runLibeufinAnastasisFacadeTest.suites = ["libeufin"]; diff --git a/packages/taler-wallet-cli/src/integrationtests/test-payment-transient.ts b/packages/taler-wallet-cli/src/integrationtests/test-payment-transient.ts index bbe4325d0..2c417e715 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-payment-transient.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-payment-transient.ts @@ -81,6 +81,8 @@ export async function runPaymentTransientTest(t: GlobalTestState) { }); if (publicOrderStatusResp.status != 402) { + + throw Error( `expected status 402 (before claiming), but got ${publicOrderStatusResp.status}`, ); |