mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-30 01:52:18 +00:00
test(ui): update payload and listMCPTools assertions for tool overrides
Co-Authored-By: bot_apk <apk@cognition.ai>
This commit is contained in:
parent
4dd482e923
commit
6494f8afad
6 changed files with 41 additions and 8 deletions
|
|
@ -179,7 +179,13 @@ describe("AgentInfoView update payload", () => {
|
|||
rpm_limit: 222,
|
||||
session_tpm_limit: 333,
|
||||
session_rpm_limit: 444,
|
||||
object_permission: { mcp_servers: [], mcp_access_groups: [], mcp_toolsets: [], mcp_tool_permissions: {}, mcp_tool_overrides: {} },
|
||||
object_permission: {
|
||||
mcp_servers: [],
|
||||
mcp_access_groups: [],
|
||||
mcp_toolsets: [],
|
||||
mcp_tool_permissions: {},
|
||||
mcp_tool_overrides: {},
|
||||
},
|
||||
access_group_ids: [],
|
||||
});
|
||||
});
|
||||
|
|
@ -221,7 +227,13 @@ describe("AgentInfoView update payload", () => {
|
|||
rpm_limit: 222,
|
||||
session_tpm_limit: 333,
|
||||
session_rpm_limit: 444,
|
||||
object_permission: { mcp_servers: [], mcp_access_groups: [], mcp_toolsets: [], mcp_tool_permissions: {}, mcp_tool_overrides: {} },
|
||||
object_permission: {
|
||||
mcp_servers: [],
|
||||
mcp_access_groups: [],
|
||||
mcp_toolsets: [],
|
||||
mcp_tool_permissions: {},
|
||||
mcp_tool_overrides: {},
|
||||
},
|
||||
access_group_ids: [],
|
||||
});
|
||||
});
|
||||
|
|
@ -300,7 +312,13 @@ describe("AgentInfoView update payload", () => {
|
|||
api_base: "https://other.example.com",
|
||||
model: "langgraph/asst_1",
|
||||
},
|
||||
object_permission: { mcp_servers: [], mcp_access_groups: [], mcp_toolsets: [], mcp_tool_permissions: {}, mcp_tool_overrides: {} },
|
||||
object_permission: {
|
||||
mcp_servers: [],
|
||||
mcp_access_groups: [],
|
||||
mcp_toolsets: [],
|
||||
mcp_tool_permissions: {},
|
||||
mcp_tool_overrides: {},
|
||||
},
|
||||
access_group_ids: [],
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -99,7 +99,13 @@ describe("AgentInfoView settings", () => {
|
|||
expect(token).toBe("sk-test");
|
||||
expect(agentId).toBe("agent-1");
|
||||
expect(payload.tpm_limit).toBe(42);
|
||||
const clearedMcpGrants = { mcp_servers: [], mcp_access_groups: [], mcp_toolsets: [], mcp_tool_permissions: {} };
|
||||
const clearedMcpGrants = {
|
||||
mcp_servers: [],
|
||||
mcp_access_groups: [],
|
||||
mcp_toolsets: [],
|
||||
mcp_tool_permissions: {},
|
||||
mcp_tool_overrides: {},
|
||||
};
|
||||
expect(payload.object_permission).toEqual(clearedMcpGrants);
|
||||
expect(payload.access_group_ids).toEqual([]);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -475,6 +475,7 @@ describe("UserEditView", () => {
|
|||
"budget_duration",
|
||||
"max_budget",
|
||||
"mcp_servers_and_groups",
|
||||
"mcp_tool_overrides",
|
||||
"mcp_tool_permissions",
|
||||
"metadata",
|
||||
"models",
|
||||
|
|
@ -494,6 +495,7 @@ describe("UserEditView", () => {
|
|||
metadata: { key1: "value1", key2: "value2" },
|
||||
mcp_servers_and_groups: { servers: [], accessGroups: [], toolsets: [] },
|
||||
mcp_tool_permissions: {},
|
||||
mcp_tool_overrides: {},
|
||||
});
|
||||
expect(typeof payload.max_budget).toBe("number");
|
||||
});
|
||||
|
|
@ -620,8 +622,8 @@ describe("UserEditView", () => {
|
|||
|
||||
expect(await screen.findByText("Via access group: group-a")).toBeInTheDocument();
|
||||
expect(await screen.findByText("Via toolset: Toolset A")).toBeInTheDocument();
|
||||
expect(networking.listMCPTools).toHaveBeenCalledWith("test-token", "srv-group");
|
||||
expect(networking.listMCPTools).toHaveBeenCalledWith("test-token", "srv-toolset");
|
||||
expect(networking.listMCPTools).toHaveBeenCalledWith("test-token", "srv-group", undefined, true);
|
||||
expect(networking.listMCPTools).toHaveBeenCalledWith("test-token", "srv-toolset", undefined, true);
|
||||
});
|
||||
|
||||
it("should send objects for the mcp keys seeded from objectPermission", async () => {
|
||||
|
|
|
|||
|
|
@ -330,6 +330,7 @@ describe("UserInfoView", () => {
|
|||
mcp_access_groups: ["dev-group"],
|
||||
mcp_toolsets: [],
|
||||
mcp_tool_permissions: { "srv-1": ["list_issues"] },
|
||||
mcp_tool_overrides: {},
|
||||
};
|
||||
expect(payload.object_permission).toEqual(expectedObjectPermission);
|
||||
expect(payload).not.toHaveProperty("mcp_servers_and_groups");
|
||||
|
|
@ -343,7 +344,7 @@ describe("UserInfoView", () => {
|
|||
|
||||
await screen.findByText("Save Changes");
|
||||
await waitFor(() => {
|
||||
expect(mockListMCPTools).toHaveBeenCalledWith("test-token", "srv-1");
|
||||
expect(mockListMCPTools).toHaveBeenCalledWith("test-token", "srv-1", undefined, true);
|
||||
});
|
||||
await waitFor(() => {
|
||||
expect(screen.queryByText("Loading tools...")).not.toBeInTheDocument();
|
||||
|
|
|
|||
|
|
@ -1182,6 +1182,7 @@ describe("Teams - which fields reach the create payload depends on the open sect
|
|||
expect(Object.keys(payload).sort()).toEqual([
|
||||
"budget_duration",
|
||||
"max_budget",
|
||||
"mcp_tool_overrides",
|
||||
"metadata",
|
||||
"models",
|
||||
"organization_id",
|
||||
|
|
@ -1317,11 +1318,13 @@ describe("Teams - the exact bytes the create call sends", () => {
|
|||
rpm_limit: undefined,
|
||||
tpd_limit: undefined,
|
||||
metadata: undefined,
|
||||
mcp_tool_overrides: {},
|
||||
});
|
||||
expect(wireBody(payload)).toStrictEqual({
|
||||
team_alias: "Byte Contract Team",
|
||||
organization_id: null,
|
||||
models: ["no-default-models"],
|
||||
mcp_tool_overrides: {},
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -1359,6 +1362,7 @@ describe("Teams - the exact bytes the create call sends", () => {
|
|||
allowed_passthrough_routes: undefined,
|
||||
allowed_mcp_servers_and_groups: undefined,
|
||||
mcp_tool_permissions: {},
|
||||
mcp_tool_overrides: {},
|
||||
allowed_agents_and_groups: undefined,
|
||||
object_permission_search_tools: undefined,
|
||||
});
|
||||
|
|
@ -1367,6 +1371,7 @@ describe("Teams - the exact bytes the create call sends", () => {
|
|||
organization_id: null,
|
||||
models: ["no-default-models"],
|
||||
mcp_tool_permissions: {},
|
||||
mcp_tool_overrides: {},
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -1529,6 +1534,7 @@ describe("Teams - the exact bytes the create call sends", () => {
|
|||
access_group_ids: undefined,
|
||||
allowed_vector_store_ids: undefined,
|
||||
allowed_passthrough_routes: undefined,
|
||||
mcp_tool_overrides: {},
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ describe("KeyEditView", () => {
|
|||
mcp_servers: [],
|
||||
mcp_access_groups: [],
|
||||
mcp_tool_permissions: {},
|
||||
mcp_tool_overrides: {},
|
||||
mcp_tool_overrides: {},
|
||||
vector_stores: [],
|
||||
},
|
||||
auto_rotate: false,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue