aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2021-03-02 20:20:51 +0100
committerFlorian Dold <florian@dold.me>2021-03-02 20:20:51 +0100
commit9c2440718d566bf28a61c732849a3aa5d3ad82bb (patch)
treea5b01ae5ad50a4c0ce88f798092ce24dfaa692f1
parent81be4aacd80689542367b1570d4069cba3220ae6 (diff)
test merchant's instance detail response
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/harness.ts8
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-merchant-instances.ts13
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"];