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;
|
||||
}
|
||||
|
||||
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":
|
||||
|
@ -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"];
|
||||
|
Loading…
Reference in New Issue
Block a user