test: add tests for tailored customizations
This commit is contained in:
parent
b203658bac
commit
87c754fb45
6 changed files with 28 additions and 8 deletions
|
|
@ -198,7 +198,6 @@ describe('First boot request generated correctly', () => {
|
|||
const expectedRequest = {
|
||||
...blueprintRequest,
|
||||
customizations: {
|
||||
filesystem: [{ min_size: 10737418240, mountpoint: '/' }],
|
||||
openscap: {
|
||||
profile_id: 'xccdf_org.ssgproject.content_profile_standard',
|
||||
},
|
||||
|
|
@ -229,7 +228,6 @@ describe('First boot request generated correctly', () => {
|
|||
const expectedRequest = {
|
||||
...blueprintRequest,
|
||||
customizations: {
|
||||
filesystem: [{ min_size: 10737418240, mountpoint: '/' }],
|
||||
openscap: {
|
||||
profile_id: 'xccdf_org.ssgproject.content_profile_standard',
|
||||
},
|
||||
|
|
|
|||
|
|
@ -337,7 +337,6 @@ describe('Kernel request generated correctly', () => {
|
|||
const expectedRequest = {
|
||||
...blueprintRequest,
|
||||
customizations: {
|
||||
filesystem: [{ min_size: 10737418240, mountpoint: '/' }],
|
||||
openscap: {
|
||||
profile_id: 'xccdf_org.ssgproject.content_profile_ccn_basic',
|
||||
},
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ const goToComplianceStep = async () => {
|
|||
const button = await screen.findByLabelText('Insights compliance');
|
||||
await waitFor(() => user.click(button));
|
||||
// wait until all policies are loaded
|
||||
await screen.findByText('None');
|
||||
await screen.findByText('Select a policy');
|
||||
};
|
||||
|
||||
const goToReviewStep = async () => {
|
||||
|
|
@ -65,7 +65,7 @@ const goToReviewStep = async () => {
|
|||
const selectPolicy = async () => {
|
||||
const user = userEvent.setup();
|
||||
|
||||
const policyMenu = await screen.findByText('None');
|
||||
const policyMenu = await screen.findByText('Select a policy');
|
||||
await waitFor(() => user.click(policyMenu));
|
||||
|
||||
const cisl2 = await screen.findByRole('option', {
|
||||
|
|
@ -162,7 +162,8 @@ describe('Compliance edit mode', () => {
|
|||
name: /Selected/i,
|
||||
});
|
||||
user.click(selectedBtn);
|
||||
await screen.findByText('aide');
|
||||
await screen.findByText('emacs');
|
||||
|
||||
expect(screen.queryByText('aide')).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
3
src/test/fixtures/editMode.ts
vendored
3
src/test/fixtures/editMode.ts
vendored
|
|
@ -660,7 +660,8 @@ export const complianceCreateBlueprintRequest: CreateBlueprintRequest = {
|
|||
name: mockBlueprintNames['compliance'],
|
||||
description: mockBlueprintDescriptions['compliance'],
|
||||
customizations: {
|
||||
packages: expectedPackagesCisL2,
|
||||
// filter out a single package to simulate the customizations being tailored
|
||||
packages: expectedPackagesCisL2.filter((p) => p !== 'aide'),
|
||||
openscap: {
|
||||
policy_id: '0ee9a781-b53f-4d9e-91e1-d75aed088c44',
|
||||
},
|
||||
|
|
|
|||
15
src/test/fixtures/oscap.ts
vendored
15
src/test/fixtures/oscap.ts
vendored
|
|
@ -1,3 +1,5 @@
|
|||
import { mockPolicies } from './compliance';
|
||||
|
||||
import {
|
||||
GetOscapProfilesApiResponse,
|
||||
GetOscapCustomizationsApiResponse,
|
||||
|
|
@ -90,7 +92,6 @@ export const oscapCustomizations = (
|
|||
};
|
||||
}
|
||||
return {
|
||||
filesystem: [{ min_size: 1073741824, mountpoint: '/tmp' }],
|
||||
openscap: {
|
||||
profile_id: 'content_profile_stig_gui',
|
||||
profile_name: 'DISA STIG with GUI for Red Hat Enterprise Linux 8',
|
||||
|
|
@ -114,3 +115,15 @@ export const oscapCustomizations = (
|
|||
},
|
||||
};
|
||||
};
|
||||
|
||||
export const oscapCustomizationsPolicy = (
|
||||
policy: string
|
||||
): GetOscapCustomizationsApiResponse => {
|
||||
const policyData = mockPolicies.data.find((p) => p.id === policy);
|
||||
const customizations = oscapCustomizations(policyData!.ref_id);
|
||||
// filter out a single package to simulate the customizations being tailored
|
||||
customizations.packages = customizations.packages!.filter(
|
||||
(p) => p !== 'aide'
|
||||
);
|
||||
return customizations;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import { mockedFeatureResponse } from '../fixtures/features';
|
|||
import {
|
||||
distributionOscapProfiles,
|
||||
oscapCustomizations,
|
||||
oscapCustomizationsPolicy,
|
||||
} from '../fixtures/oscap';
|
||||
import {
|
||||
mockPkgRecommendations,
|
||||
|
|
@ -162,6 +163,13 @@ export const handlers = [
|
|||
return HttpResponse.json(oscapCustomizations(profile));
|
||||
}
|
||||
),
|
||||
http.get(
|
||||
`${IMAGE_BUILDER_API}/oscap/:policy/:distribution/policy_customizations`,
|
||||
({ params }) => {
|
||||
const { policy } = params;
|
||||
return HttpResponse.json(oscapCustomizationsPolicy(policy));
|
||||
}
|
||||
),
|
||||
http.get(`${IMAGE_BUILDER_API}/blueprints`, ({ request }) => {
|
||||
const url = new URL(request.url);
|
||||
const nameParam = url.searchParams.get('name');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue