Implemented the Create Internal Service Request functionality
This commit is contained in:
@@ -20,6 +20,26 @@ function fixture() {
|
||||
return { ...dom, app, add, nodes, tab, ids, select };
|
||||
}
|
||||
|
||||
test("catalog and identity secrets are revealed exactly by the eye button and hidden again", () => {
|
||||
const h = fixture();
|
||||
const body = JSON.stringify({ result: "catalog-exact-secret", detail: "Preserved" });
|
||||
h.app.debugContentLog.appendBackgroundRequestLog([{
|
||||
name: "requestSrTokenCatalog", method: "POST", startedAt: new Date().toISOString(), status: "success",
|
||||
responseBody: body, requestHeaders: { "vb-proxy-header-x-oracle-ectoken": "header-exact-secret", "x-appbuilder-client-id": "client-exact-secret" }
|
||||
}, {
|
||||
name: "requestCurrentUser", method: "GET", startedAt: new Date().toISOString(), status: "success",
|
||||
responseBody: JSON.stringify({ user: { roles: ["SIMPLE_USER"] }, token: "identity-exact-secret" })
|
||||
}]);
|
||||
const text = node => node.text + node.children.map(text).join("");
|
||||
const toggle = () => h.nodes().find(node => node.getAttribute("data-debug-focus") === "visibility").listeners.click();
|
||||
assert.doesNotMatch(text(h.panel), /exact-secret/);
|
||||
toggle();
|
||||
for (const secret of ["catalog-exact-secret", "header-exact-secret", "client-exact-secret", "identity-exact-secret"]) assert.ok(text(h.panel).includes(secret));
|
||||
toggle();
|
||||
assert.doesNotMatch(text(h.panel), /exact-secret/);
|
||||
assert.equal(h.app.debugState.requestLog[0].responseBody, body, "display masking never overwrites originals");
|
||||
});
|
||||
|
||||
test("request summaries show duration after status, including zero, failure and pending", () => {
|
||||
const h = fixture();
|
||||
h.add("duration", "requestOpportunities", 1);
|
||||
@@ -33,23 +53,23 @@ test("request summaries show duration after status, including zero, failure and
|
||||
}
|
||||
});
|
||||
|
||||
test("large response previews stay valid, formatted, masked and colored in both runtimes", () => {
|
||||
test("complete large responses stay formatted, masked and colored in both runtimes", () => {
|
||||
const h = fixture();
|
||||
const background = loadApplication("background");
|
||||
const body = JSON.stringify({ items: Array.from({ length: 2000 }, (_, index) => ({
|
||||
id: index, name: "Synthetic opportunity", access_token: "synthetic-secret",
|
||||
uiaasHeader: { value: "synthetic-header-secret" }, owner: { name: "Synthetic owner" }
|
||||
})) });
|
||||
for (const [logger, limit] of [[h.app.debugContentLog, 12000], [background.httpBackgroundJson, 100000]]) {
|
||||
for (const logger of [h.app.debugContentLog, background.httpBackgroundJson]) {
|
||||
const preview = logger.createDebugBody(body);
|
||||
assert.equal(preview.truncated, true);
|
||||
assert.ok(preview.value.length <= limit);
|
||||
assert.equal(preview.truncated, false);
|
||||
assert.equal(preview.value, body);
|
||||
const parsed = JSON.parse(preview.value);
|
||||
assert.match(parsed.debugNotice, /Partial response/);
|
||||
assert.ok(parsed.preview.items.length > 0);
|
||||
assert.ok(parsed.preview.items.length < 2000);
|
||||
assert.equal(parsed.items.length, 2000);
|
||||
assert.equal(parsed.items.at(-1).id, 1999);
|
||||
const formatted = h.app.debugContentLog.formatDebugBody(preview.value);
|
||||
assert.match(formatted, /\n "debugNotice"/);
|
||||
assert.match(formatted, /\n "items"/);
|
||||
assert.match(formatted, /"id": 1999/);
|
||||
assert.doesNotMatch(formatted, /synthetic-secret|synthetic-header-secret/);
|
||||
const container = h.document.createElement("div");
|
||||
h.app.debugContentView.appendDebugBlock(container, "Response Body", formatted);
|
||||
@@ -58,7 +78,9 @@ test("large response previews stay valid, formatted, masked and colored in both
|
||||
assert.match(h.app.debugContentLog.formatDebugBody(preview.value), /synthetic-secret/);
|
||||
h.app.debugState.debugSecretsVisible = false;
|
||||
assert.equal(logger.createDebugBody('{"ok":true}').value, '{"ok":true}');
|
||||
assert.match(logger.createDebugBody("<html>" + "x".repeat(limit + 1000)).value, /truncated/);
|
||||
const html = "<html>" + "x".repeat(150000) + "</html>";
|
||||
assert.equal(logger.createDebugBody(html).value, html);
|
||||
assert.equal(logger.createDebugBody("").value, "(empty response body)");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -69,7 +91,7 @@ test("request categories cover every current family and unknown requests stay vi
|
||||
requestConsumerTokenService: "authentication", requestCustomerTokenService: "authentication",
|
||||
requestOpportunities: "opportunities", requestOpptyProducts: "products", requestGenerateAiSummary: "ai",
|
||||
requestAccountSummary: "consumption", requestAccountPlans: "consumption",
|
||||
requestInstallBase: "installBase", requestCustomerServiceRequest: "serviceRequests",
|
||||
requestInstallBase: "installBase", requestCustomerServiceRequest: "serviceRequests", requestSRInfo: "serviceRequests",
|
||||
requestConsumptionPlanDetail: "consumption",
|
||||
requestRatecardByPlan: "consumption",
|
||||
requestConsumptionServiceQuarterly: "consumption", requestConsumptionServiceMonthly: "consumption",
|
||||
|
||||
Reference in New Issue
Block a user