mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-10-09 21:14:22 +00:00
fix(ui): correct GCP organization credential labels (#12362)
This commit is contained in:
@@ -0,0 +1 @@
|
||||
`Client Secret` and `Refresh Token` labels in the GCP organization authentication form
|
||||
@@ -0,0 +1,62 @@
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { ORG_SETUP_PHASE } from "@/types/organizations";
|
||||
|
||||
import { GcpOrgSetupForm } from "./gcp-org-setup-form";
|
||||
|
||||
vi.mock("@/actions/organizations/organizations", () => ({
|
||||
updateOrganizationName: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock("./hooks/use-org-setup-submission", () => ({
|
||||
useOrgSetupSubmission: () => ({
|
||||
apiError: null,
|
||||
setApiError: vi.fn(),
|
||||
submitOrganizationSetup: vi.fn(),
|
||||
replaceSecretWarning: null,
|
||||
confirmSecretReplace: vi.fn(),
|
||||
cancelSecretReplace: vi.fn(),
|
||||
discoveryTimedOut: false,
|
||||
discoveryFailed: false,
|
||||
isSubmissionPending: false,
|
||||
keepWaitingForDiscovery: vi.fn(),
|
||||
retryDiscovery: vi.fn(),
|
||||
}),
|
||||
}));
|
||||
|
||||
describe("GcpOrgSetupForm", () => {
|
||||
describe("when static credentials are selected", () => {
|
||||
it("should preserve the labels of masked credential fields", async () => {
|
||||
// Given
|
||||
const user = userEvent.setup();
|
||||
render(
|
||||
<GcpOrgSetupForm
|
||||
onBack={vi.fn()}
|
||||
onNext={vi.fn()}
|
||||
onFooterChange={vi.fn()}
|
||||
onPhaseChange={vi.fn()}
|
||||
initialPhase={ORG_SETUP_PHASE.ACCESS}
|
||||
/>,
|
||||
);
|
||||
|
||||
// When
|
||||
await user.click(
|
||||
screen.getByRole("radio", {
|
||||
name: /client id, client secret and refresh token/i,
|
||||
}),
|
||||
);
|
||||
|
||||
// Then
|
||||
expect(screen.getByLabelText("Client Secret")).toHaveAttribute(
|
||||
"type",
|
||||
"password",
|
||||
);
|
||||
expect(screen.getByLabelText("Refresh Token")).toHaveAttribute(
|
||||
"type",
|
||||
"password",
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -470,7 +470,7 @@ export function GcpOrgSetupForm({
|
||||
name="clientSecret"
|
||||
label="Client Secret"
|
||||
labelPlacement="outside"
|
||||
password
|
||||
type="password"
|
||||
isRequired
|
||||
/>
|
||||
<WizardInputField
|
||||
@@ -478,7 +478,7 @@ export function GcpOrgSetupForm({
|
||||
name="refreshToken"
|
||||
label="Refresh Token"
|
||||
labelPlacement="outside"
|
||||
password
|
||||
type="password"
|
||||
isRequired
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user