Wizard: Display customized policy rules in review summary
Previously, when a user selected a compliance policy with tailored rules,
the review page always showed the default profile customizations instead
of the policy-specific customizations.
Root cause: OscapProfileInformation component was only using the profile
endpoint (/oscap/{distribution}/{profile}/customizations) which returns
base profile rules, not the policy endpoint
(/oscap/{policy}/{distribution}/policy_customizations) which returns
customized rules.
Changes:
- Add useGetOscapCustomizationsForPolicyQuery export to backendApi
- Implement dual data fetching in OscapProfileInformation:
* Profile endpoint: for description and reference ID
* Policy endpoint: for customized packages, services, kernel args
Fixes the compliance policy customization display bug where edited
policy rules were not reflected in the image build summary.
Add unit tests for compliance policy customizations
Fix profile description title
This commit is contained in:
parent
42b16bafd8
commit
bf77501eea
6 changed files with 115 additions and 23 deletions
|
|
@ -332,4 +332,30 @@ describe('OpenSCAP edit mode', () => {
|
|||
user.click(selectedBtn);
|
||||
await screen.findByText('neovim');
|
||||
});
|
||||
|
||||
test('customized policy shows only non-removed rules', async () => {
|
||||
const { oscapCustomizations, oscapCustomizationsPolicy } = await import(
|
||||
'../../../../fixtures/oscap'
|
||||
);
|
||||
|
||||
const profileId = 'xccdf_org.ssgproject.content_profile_cis_workstation_l1';
|
||||
const normalProfile = oscapCustomizations(profileId);
|
||||
expect(normalProfile.packages).toEqual(['aide', 'neovim']);
|
||||
const customPolicy = oscapCustomizationsPolicy('custom-policy-123');
|
||||
expect(customPolicy.packages).toEqual(['neovim']);
|
||||
await renderCreateMode();
|
||||
await selectRhel9();
|
||||
await selectGuestImageTarget();
|
||||
await goToOscapStep();
|
||||
await selectProfile();
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText(/aide, neovim/i)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
expect(customPolicy.packages).not.toContain('aide');
|
||||
expect(customPolicy.packages).toContain('neovim');
|
||||
expect(normalProfile.packages).toContain('aide');
|
||||
expect(normalProfile.packages).toContain('neovim');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue