test merchant's instance detail response
This commit is contained in:
parent
81be4aacd8
commit
9c2440718d
@ -1194,6 +1194,14 @@ export class MerchantApiClient {
|
|||||||
return resp.data;
|
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> {
|
makeAuthHeader(): Record<string, string> {
|
||||||
switch (this.auth.method) {
|
switch (this.auth.method) {
|
||||||
case "external":
|
case "external":
|
||||||
|
@ -100,6 +100,11 @@ export async function runMerchantInstancesTest(t: GlobalTestState) {
|
|||||||
t.assertDeepEqual(resp.status, 200);
|
t.assertDeepEqual(resp.status, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const fullDetails = await merchantClient.getInstanceFullDetails("default");
|
||||||
|
t.assertDeepEqual(fullDetails.auth.method, "external");
|
||||||
|
}
|
||||||
|
|
||||||
await merchantClient.changeAuth({
|
await merchantClient.changeAuth({
|
||||||
method: "token",
|
method: "token",
|
||||||
token: "secret-token:foobar",
|
token: "secret-token:foobar",
|
||||||
@ -133,6 +138,14 @@ export async function runMerchantInstancesTest(t: GlobalTestState) {
|
|||||||
});
|
});
|
||||||
t.assertDeepEqual(resp.status, 200);
|
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"];
|
runMerchantInstancesTest.suites = ["merchant"];
|
||||||
|
Loading…
Reference in New Issue
Block a user