mirror of
https://github.com/fleetdm/fleet
synced 2026-05-19 06:58:30 +00:00
Keep the vulnerabilities detected via NVD and stored in the DB in sync. with the results from the NVD vulnerability process.
56 lines
928 B
Go
56 lines
928 B
Go
package fleet
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestSoftwareIterQueryOptionsIsValid(t *testing.T) {
|
|
testCases := []struct {
|
|
excluded []string
|
|
included []string
|
|
isNotValid bool
|
|
}{
|
|
{
|
|
excluded: nil,
|
|
included: nil,
|
|
},
|
|
{
|
|
excluded: []string{"a", "b"},
|
|
included: nil,
|
|
},
|
|
{
|
|
excluded: nil,
|
|
included: []string{"a", "b"},
|
|
},
|
|
{
|
|
excluded: []string{"a", "b"},
|
|
included: []string{"a"},
|
|
isNotValid: true,
|
|
},
|
|
{
|
|
excluded: []string{"a"},
|
|
included: []string{"a", "b"},
|
|
isNotValid: true,
|
|
},
|
|
{
|
|
excluded: []string{"c"},
|
|
included: []string{"a", "b"},
|
|
isNotValid: true,
|
|
},
|
|
}
|
|
|
|
for _, tC := range testCases {
|
|
sut := SoftwareIterQueryOptions{
|
|
ExcludedSources: tC.excluded,
|
|
IncludedSources: tC.included,
|
|
}
|
|
|
|
if tC.isNotValid {
|
|
require.False(t, sut.IsValid())
|
|
} else {
|
|
require.True(t, sut.IsValid())
|
|
}
|
|
}
|
|
}
|