rebuild(llm): add audited model connectivity tests
This commit is contained in:
@@ -102,3 +102,36 @@ test("administrator can audit jobs, backfill and govern market events", async ({
|
||||
{ kind: "supplement" },
|
||||
]);
|
||||
});
|
||||
|
||||
test("administrator tests a selected model without exposing its key", async ({ page }) => {
|
||||
await page.route("**/api/admin/models", (route) => route.fulfill({
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify([{
|
||||
id: 1,
|
||||
display_name: "主模型",
|
||||
base_url: "https://model.example.com/v1",
|
||||
model_identifier: "reasoning-model",
|
||||
has_api_key: true,
|
||||
is_primary: true,
|
||||
is_fallback: false,
|
||||
updated_at: "2026-07-30T10:00:00+08:00",
|
||||
}]),
|
||||
}));
|
||||
await page.route("**/api/admin/models/1/test", (route) => route.fulfill({
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({
|
||||
connected: true,
|
||||
message: "连接成功",
|
||||
duration_ms: 286,
|
||||
request_id: "audit-request",
|
||||
}),
|
||||
}));
|
||||
|
||||
await authenticate(page);
|
||||
await page.getByRole("button", { name: "系统管理" }).click();
|
||||
await page.getByRole("button", { name: "模型池" }).click();
|
||||
await page.getByRole("button", { name: "主模型 reasoning-model 主模型" }).click();
|
||||
await page.getByRole("button", { name: "测试连接" }).click();
|
||||
await expect(page.getByText("连接成功 · 286 ms", { exact: true })).toBeVisible();
|
||||
await expect(page.locator("body")).not.toContainText(/secret|api[_ -]?key/i);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user