diff options
Diffstat (limited to 'packages')
-rw-r--r-- | packages/taler-wallet-cli/src/integrationtests/harness.ts | 8 | ||||
-rw-r--r-- | packages/taler-wallet-cli/src/integrationtests/test-merchant-instances.ts | 13 |
2 files changed, 21 insertions, 0 deletions
diff --git a/packages/taler-wallet-cli/src/integrationtests/harness.ts b/packages/taler-wallet-cli/src/integrationtests/harness.ts index fbc67bb5a..cb8b59a5c 100644 --- a/packages/taler-wallet-cli/src/integrationtests/harness.ts +++ b/packages/taler-wallet-cli/src/integrationtests/harness.ts @@ -1194,6 +1194,14 @@ export class MerchantApiClient { return resp.data; } + async getInstanceFullDetails(instanceId: string): Promise<any> { + const url = new URL(`private/instances/${instanceId}`, this.baseUrl); + const resp = await axios.get(url.href, { + headers: this.makeAuthHeader(), + }); + return resp.data; + } + makeAuthHeader(): Record<string, string> { switch (this.auth.method) { case "external": diff --git a/packages/taler-wallet-cli/src/integrationtests/test-merchant-instances.ts b/packages/taler-wallet-cli/src/integrationtests/test-merchant-instances.ts index d2e4cd121..4691487de 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-merchant-instances.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-merchant-instances.ts @@ -100,6 +100,11 @@ export async function runMerchantInstancesTest(t: GlobalTestState) { t.assertDeepEqual(resp.status, 200); } + { + const fullDetails = await merchantClient.getInstanceFullDetails("default"); + t.assertDeepEqual(fullDetails.auth.method, "external"); + } + await merchantClient.changeAuth({ method: "token", token: "secret-token:foobar", @@ -133,6 +138,14 @@ export async function runMerchantInstancesTest(t: GlobalTestState) { }); t.assertDeepEqual(resp.status, 200); } + + // Check that auth is reported properly + { + const fullDetails = await merchantClient.getInstanceFullDetails("default"); + t.assertDeepEqual(fullDetails.auth.method, "token"); + // Token should *not* be reported back. + t.assertDeepEqual(fullDetails.auth.token, undefined); + } } runMerchantInstancesTest.suites = ["merchant"]; |