feat(report): Change the priority of CVE information in Debian (#1202)
* fix (bug) : using ScanResults refs #1019 * feat(gost): WIP change priority of CVE Info in Debian * feat(report): change priority of CVE Info in Debian * refactor: move RemoveRaspbianPackFromResult * style: remove comment * fix: lint error * style: change coding style * feat(report): support reporting with gost alone * fix: merge error * refactor(debian): change code to be simple
This commit is contained in:
@@ -94,6 +94,55 @@ func TestIsDisplayUpdatableNum(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRemoveRaspbianPackFromResult(t *testing.T) {
|
||||
var tests = []struct {
|
||||
in ScanResult
|
||||
expected ScanResult
|
||||
}{
|
||||
{
|
||||
in: ScanResult{
|
||||
Family: constant.Raspbian,
|
||||
Packages: Packages{
|
||||
"apt": Package{Name: "apt", Version: "1.8.2.1"},
|
||||
"libraspberrypi-dev": Package{Name: "libraspberrypi-dev", Version: "1.20200811-1"},
|
||||
},
|
||||
SrcPackages: SrcPackages{},
|
||||
},
|
||||
expected: ScanResult{
|
||||
Family: constant.Raspbian,
|
||||
Packages: Packages{
|
||||
"apt": Package{Name: "apt", Version: "1.8.2.1"},
|
||||
},
|
||||
SrcPackages: SrcPackages{},
|
||||
},
|
||||
},
|
||||
{
|
||||
in: ScanResult{
|
||||
Family: constant.Debian,
|
||||
Packages: Packages{
|
||||
"apt": Package{Name: "apt", Version: "1.8.2.1"},
|
||||
},
|
||||
SrcPackages: SrcPackages{},
|
||||
},
|
||||
expected: ScanResult{
|
||||
Family: constant.Debian,
|
||||
Packages: Packages{
|
||||
"apt": Package{Name: "apt", Version: "1.8.2.1"},
|
||||
},
|
||||
SrcPackages: SrcPackages{},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for i, tt := range tests {
|
||||
r := tt.in
|
||||
r = *r.RemoveRaspbianPackFromResult()
|
||||
if !reflect.DeepEqual(r, tt.expected) {
|
||||
t.Errorf("[%d] expected %+v, actual %+v", i, tt.expected, r)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestScanResult_Sort(t *testing.T) {
|
||||
type fields struct {
|
||||
Packages Packages
|
||||
|
||||
Reference in New Issue
Block a user