account for repoDigests data in power-user json testing

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
Alex Goodman
2021-03-30 08:46:42 -04:00
parent db35186c7d
commit cd925e5664
5 changed files with 64 additions and 67 deletions
@@ -47,6 +47,7 @@ func TestJSONPresenter(t *testing.T) {
Metadata: pkg.PythonPackageMetadata{
Name: "package-1",
Version: "1.0.1",
Files: []pkg.PythonFileRecord{},
},
PURL: "a-purl-1",
CPEs: []pkg.CPE{
@@ -68,6 +69,7 @@ func TestJSONPresenter(t *testing.T) {
Metadata: pkg.DpkgMetadata{
Package: "package-2",
Version: "2.0.1",
Files: []pkg.DpkgFileRecord{},
},
PURL: "a-purl-2",
CPEs: []pkg.CPE{
@@ -76,8 +78,12 @@ func TestJSONPresenter(t *testing.T) {
})
cfg := JSONDocumentConfig{
ApplicationConfig: config.Application{},
PackageCatalog: catalog,
ApplicationConfig: config.Application{
FileMetadata: config.FileMetadata{
Digests: []string{"sha256"},
},
},
PackageCatalog: catalog,
FileMetadata: map[source.Location]source.FileMetadata{
source.NewLocation("/a/place"): {
Mode: 0775,
@@ -149,6 +155,7 @@ func TestJSONPresenter(t *testing.T) {
},
RawManifest: []byte("eyJzY2hlbWFWZXJzaW9uIjoyLCJtZWRpYVR5cGUiOiJh..."),
RawConfig: []byte("eyJhcmNoaXRlY3R1cmUiOiJhbWQ2NCIsImNvbmZp..."),
RepoDigests: []string{},
},
},
}
@@ -162,7 +169,7 @@ func TestJSONPresenter(t *testing.T) {
testutils.UpdateGoldenFileContents(t, actual)
}
var expected = testutils.GetGoldenFileContents(t)
expected := testutils.GetGoldenFileContents(t)
if !bytes.Equal(expected, actual) {
dmp := diffmatchpatch.New()
@@ -115,7 +115,7 @@
"architecture": "",
"maintainer": "",
"installedSize": 0,
"files": null
"files": []
}
}
],
@@ -145,6 +145,7 @@
],
"manifest": "ZXlKelkyaGxiV0ZXWlhKemFXOXVJam95TENKdFpXUnBZVlI1Y0dVaU9pSmguLi4=",
"config": "ZXlKaGNtTm9hWFJsWTNSMWNtVWlPaUpoYldRMk5DSXNJbU52Ym1acC4uLg==",
"repoDigests": [],
"scope": ""
}
},
@@ -187,7 +188,9 @@
"enabled": false,
"scope": ""
},
"digests": null
"digests": [
"sha256"
]
}
}
},