cloudapi: json tailoring options
Add support for json tailoring files in the cloudapi. Expand the tests to check that the options returned are okay and that tailoring options and json tailoring options can't be provided at the same time.
This commit is contained in:
parent
16180e9c58
commit
2da3a73308
4 changed files with 260 additions and 177 deletions
|
|
@ -785,4 +785,47 @@ func TestOpenSCAPTailoringOptions(t *testing.T) {
|
|||
bp, err := cr.GetBlueprintFromCustomizations()
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, expectedOscap, bp.Customizations.OpenSCAP)
|
||||
|
||||
cr = ComposeRequest{
|
||||
Customizations: &Customizations{
|
||||
Openscap: &OpenSCAP{
|
||||
ProfileId: "test-123",
|
||||
JsonTailoring: &OpenSCAPJSONTailoring{
|
||||
ProfileId: "test-123-tailoring",
|
||||
Filepath: "/some/filepath",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
expectedOscap = &blueprint.OpenSCAPCustomization{
|
||||
ProfileID: "test-123",
|
||||
JSONTailoring: &blueprint.OpenSCAPJSONTailoringCustomizations{
|
||||
ProfileID: "test-123-tailoring",
|
||||
Filepath: "/some/filepath",
|
||||
},
|
||||
}
|
||||
|
||||
bp, err = cr.GetBlueprintFromCustomizations()
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, expectedOscap, bp.Customizations.OpenSCAP)
|
||||
|
||||
cr = ComposeRequest{
|
||||
Customizations: &Customizations{
|
||||
Openscap: &OpenSCAP{
|
||||
ProfileId: "test-123",
|
||||
Tailoring: &OpenSCAPTailoring{
|
||||
Selected: common.ToPtr([]string{"one", "two", "three"}),
|
||||
Unselected: common.ToPtr([]string{"four", "five", "six"}),
|
||||
},
|
||||
JsonTailoring: &OpenSCAPJSONTailoring{
|
||||
ProfileId: "test-123-tailoring",
|
||||
Filepath: "/some/filepath",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
bp, err = cr.GetBlueprintFromCustomizations()
|
||||
assert.Error(t, err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue