-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from interlynk-io/spdx-cpetype-test
Test case for CPE type on SPDX file
- Loading branch information
Showing
9 changed files
with
1,985 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ func cdxBOM() *cydx.BOM { | |
Name: "go-testlib", | ||
Version: "v0.0.3", | ||
PackageURL: "pkg:golang/github.com/interlynk-io/[email protected]", | ||
CPE: "cpe:2:a:golang:go-testlib:v0.0.3:*:*:*:*:*:*:*", | ||
CPE: "cpe:2:a:golang:go-testlib:v0.0.3:*:*:*:*:*:*:*", | ||
}, | ||
{ | ||
BOMRef: "pkg:golang/github.com/dummy/[email protected]", | ||
|
@@ -60,7 +60,7 @@ func cdxBOM() *cydx.BOM { | |
Name: "dummyArrayLib", | ||
Version: "v2.4.1", | ||
PackageURL: "pkg:golang/github.com/dummy/[email protected]", | ||
CPE: "cpe:/o:dummy:dummyArrayLib:2.4.1:update4", | ||
CPE: "cpe:/o:dummy:dummyArrayLib:2.4.1:update4", | ||
Supplier: &cydx.OrganizationalEntity{ | ||
Name: "", | ||
}, | ||
|
@@ -138,8 +138,8 @@ func Test_cdxDoc_addSupplierName(t *testing.T) { | |
|
||
func Test_cdxDoc_parseComps_Cpes(t *testing.T) { | ||
type fields struct { | ||
doc *cydx.BOM | ||
comps []Component | ||
doc *cydx.BOM | ||
comps []Component | ||
} | ||
type args struct { | ||
index int | ||
|
@@ -157,7 +157,8 @@ func Test_cdxDoc_parseComps_Cpes(t *testing.T) { | |
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
c := &cdxDoc{ | ||
doc: tt.fields.doc, | ||
doc: tt.fields.doc, | ||
comps: tt.fields.comps, | ||
} | ||
c.parseComps() | ||
if got := c.comps[tt.args.index].Cpes(); len(got) != tt.want { | ||
|
@@ -168,16 +169,10 @@ func Test_cdxDoc_parseComps_Cpes(t *testing.T) { | |
|
||
} | ||
|
||
|
||
func Test_cdxDoc_parseComps_purl(t *testing.T) { | ||
type fields struct { | ||
doc *cydx.BOM | ||
spec *spec | ||
comps []Component | ||
authors []Author | ||
tools []Tool | ||
rels []Relation | ||
logs []string | ||
doc *cydx.BOM | ||
comps []Component | ||
} | ||
type args struct { | ||
index int | ||
|
@@ -195,13 +190,8 @@ func Test_cdxDoc_parseComps_purl(t *testing.T) { | |
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
c := &cdxDoc{ | ||
doc: tt.fields.doc, | ||
spec: tt.fields.spec, | ||
comps: tt.fields.comps, | ||
authors: tt.fields.authors, | ||
tools: tt.fields.tools, | ||
rels: tt.fields.rels, | ||
logs: tt.fields.logs, | ||
doc: tt.fields.doc, | ||
comps: tt.fields.comps, | ||
} | ||
c.parseComps() | ||
if got := c.comps[tt.args.index].Purls(); len(got) != tt.want { | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.