mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-05 20:40:16 -08:00
45 lines
780 B
Go
45 lines
780 B
Go
package report
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestReportWriter_toSarifErrorLevel(t *testing.T) {
|
|
tests := []struct {
|
|
severity string
|
|
sarifErrorLevel string
|
|
}{
|
|
{
|
|
severity: "CRITICAL",
|
|
sarifErrorLevel: "error",
|
|
},
|
|
{
|
|
severity: "HIGH",
|
|
sarifErrorLevel: "error",
|
|
},
|
|
{
|
|
severity: "MEDIUM",
|
|
sarifErrorLevel: "warning",
|
|
},
|
|
{
|
|
severity: "LOW",
|
|
sarifErrorLevel: "note",
|
|
},
|
|
{
|
|
severity: "UNKNOWN",
|
|
sarifErrorLevel: "note",
|
|
},
|
|
{
|
|
severity: "OTHER",
|
|
sarifErrorLevel: "none",
|
|
},
|
|
}
|
|
for _, tc := range tests {
|
|
t.Run(tc.severity, func(t *testing.T) {
|
|
assert.Equal(t, tc.sarifErrorLevel, toSarifErrorLevel(tc.severity), tc.severity)
|
|
})
|
|
}
|
|
}
|