Added test and support of ASFF template (#594)

* Added test and support of ASFF template

* Improve test coverage

* Fixed/Improved tests

* Removed extra space

* Added NVD score/vectors, Added logic to trim description due to file size restriction

* Included quotations around AccountID
This commit is contained in:
rahul2393
2020-08-12 15:55:58 +05:30
committed by GitHub
parent 8ca484f538
commit 675e1b4118
6 changed files with 307 additions and 0 deletions

View File

@@ -17,6 +17,7 @@ import (
"github.com/urfave/cli/v2"
"github.com/aquasecurity/trivy/internal"
"github.com/aquasecurity/trivy/pkg/report"
)
type args struct {
@@ -309,12 +310,27 @@ func TestClientServer(t *testing.T) {
},
golden: "testdata/busybox-with-lockfile.json.golden",
},
{
name: "alpine 3.10 integration with ASFF template",
testArgs: args{
Format: "template",
TemplatePath: "@../contrib/asff.tpl",
Version: "dev",
Input: "testdata/fixtures/alpine-310.tar.gz",
},
golden: "testdata/alpine-310.asff.golden",
},
}
app, addr, cacheDir := setup(t, "", "")
for _, c := range cases {
t.Run(c.name, func(t *testing.T) {
report.Now = func() time.Time {
return time.Date(2020, 8, 10, 7, 28, 17, 958601, time.UTC)
}
os.Setenv("AWS_REGION", "test-region")
os.Setenv("AWS_ACCOUNT_ID", "123456789012")
osArgs, outputFile, cleanup := setupClient(t, c.testArgs, addr, cacheDir, c.golden)
defer cleanup()