fleet/server/webhooks/mapper_test.go
Juan Fernandez 765031d962
Bug 6717: Duplicate calls on vulnerability third party integrations. (#7698)
If the same vulnerability was present in more than one software, then duplicated third party integration calls were being issued.
2022-09-13 10:41:52 -04:00

34 lines
740 B
Go

package webhooks
import (
"net/url"
"testing"
"github.com/fleetdm/fleet/v4/server/fleet"
"github.com/fleetdm/fleet/v4/server/ptr"
"github.com/stretchr/testify/require"
)
func TestGetPaylaod(t *testing.T) {
serverURL, err := url.Parse("http://mywebsite.com")
require.NoError(t, err)
vuln := fleet.SoftwareVulnerability{
CVE: "cve-1",
SoftwareID: 1,
}
meta := fleet.CVEMeta{
CVE: "cve-1",
CVSSScore: ptr.Float64(1),
EPSSProbability: ptr.Float64(0.5),
CISAKnownExploit: ptr.Bool(true),
}
sut := Mapper{}
result := sut.GetPayload(serverURL, nil, vuln.CVE, meta)
require.Empty(t, result.CISAKnownExploit)
require.Empty(t, result.EPSSProbability)
require.Empty(t, result.CVSSScore)
}