Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
}));

vi.mock("./mcp_connection_status", () => ({
default: ({ tools }: { tools?: any[] }) => (

Check warning on line 83 in ui/litellm-dashboard/src/components/mcp_tools/create_mcp_server.test.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
<div data-testid="mcp-connection-status" data-tool-count={tools?.length ?? 0} />
),
}));
Expand Down Expand Up @@ -350,6 +350,44 @@
expect(payload.credentials).toBeUndefined();
});

it("shows the token-exchange fields only for the OAuth Token Exchange (OBO) auth type", async () => {
await selectHttpTransport();

// Plain OAuth must not render the token-exchange section.
await selectAntOption("Authentication", "OAuth");
await waitFor(() => {
expect(screen.queryByText("Token Exchange Endpoint (optional)")).not.toBeInTheDocument();
});
expect(screen.queryByText("Subject Token Type (optional)")).not.toBeInTheDocument();

await selectAntOption("Authentication", "OAuth Token Exchange (OBO)");
await waitFor(() => {
expect(screen.getByText("Token Exchange Endpoint (optional)")).toBeInTheDocument();
});
expect(screen.getByText("Subject Token Type (optional)")).toBeInTheDocument();

// Switching away hides the section again.
await selectAntOption("Authentication", "API Key");
await waitFor(() => {
expect(screen.queryByText("Token Exchange Endpoint (optional)")).not.toBeInTheDocument();
});
expect(screen.queryByText("Subject Token Type (optional)")).not.toBeInTheDocument();

// Selecting token exchange and then switching transport to stdio unmounts the
// whole Authentication section (the section-level transport gate), taking the
// token-exchange fields with it — their required client_id/client_secret rules
// cannot block a stdio submit because antd does not validate unmounted fields.
await selectAntOption("Authentication", "OAuth Token Exchange (OBO)");
await waitFor(() => {
expect(screen.getByText("Token Exchange Endpoint (optional)")).toBeInTheDocument();
});
await selectAntOption("Transport Type", "Standard Input/Output");
await waitFor(() => {
expect(screen.queryByText("Token Exchange Endpoint (optional)")).not.toBeInTheDocument();
});
expect(screen.queryByText("Subject Token Type (optional)")).not.toBeInTheDocument();
});

it("routes OAuth Token Exchange (OBO) config to the backend payload", async () => {
await selectHttpTransport();

Expand Down
Loading