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 /packages/taler-wallet-cli/src/integrationtests/test-libeufin-facade-anastasis.ts | |
parent | 1d711d441dd0c584f213abf9a97d685b82aafef8 (diff) | |
download | wallet-core-739e6576a8f9efc593fc1041de8a7cf73b06f52d.tar.xz |
Test Anastasis with user privileges,
therefore giving history permission first.
Diffstat (limited to 'packages/taler-wallet-cli/src/integrationtests/test-libeufin-facade-anastasis.ts')
-rw-r--r-- | packages/taler-wallet-cli/src/integrationtests/test-libeufin-facade-anastasis.ts | 31 |
1 files changed, 26 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"]; |