mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 08:23:15 +01:00
Include default config licenses (#3900)
* fix: the licenses config was not being carried through causing content to show by default --------- Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com>
This commit is contained in:
parent
b369b02f4f
commit
4f73d35051
@ -255,6 +255,7 @@ func (c *CreateSBOMConfig) selectTasks(src source.Description) ([]task.Task, []t
|
|||||||
RelationshipsConfig: c.Relationships,
|
RelationshipsConfig: c.Relationships,
|
||||||
DataGenerationConfig: c.DataGeneration,
|
DataGenerationConfig: c.DataGeneration,
|
||||||
PackagesConfig: c.Packages,
|
PackagesConfig: c.Packages,
|
||||||
|
LicenseConfig: c.Licenses,
|
||||||
ComplianceConfig: c.Compliance,
|
ComplianceConfig: c.Compliance,
|
||||||
FilesConfig: c.Files,
|
FilesConfig: c.Files,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@ package cli
|
|||||||
import "testing"
|
import "testing"
|
||||||
|
|
||||||
func Test_Licenses(t *testing.T) {
|
func Test_Licenses(t *testing.T) {
|
||||||
testImage := getFixtureImage(t, "image-unknown-licenses")
|
testImage := getFixtureImage(t, "image-pkg-coverage")
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
args []string
|
args []string
|
||||||
|
|||||||
@ -169,7 +169,7 @@ func assertUnknownLicenseContent(required bool) traitAssertion {
|
|||||||
|
|
||||||
for _, pkg := range data.Artifacts {
|
for _, pkg := range data.Artifacts {
|
||||||
for _, lic := range pkg.Licenses {
|
for _, lic := range pkg.Licenses {
|
||||||
if strings.Contains(lic.SPDXExpression, "UNKNOWN") && required {
|
if strings.Contains(lic.Value, "sha256") && required {
|
||||||
assert.NotZero(tb, len(lic.Contents))
|
assert.NotZero(tb, len(lic.Contents))
|
||||||
} else {
|
} else {
|
||||||
assert.Empty(tb, lic.Contents)
|
assert.Empty(tb, lic.Contents)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user