fleet/server/vulnerabilities/macoffice/integration_sync_test.go
Juan Fernandez 6ff2c449cf
Improve test coverage and bug fix (#10301)
Addresses https://github.com/fleetdm/fleet/issues/10112

Improved test coverage, also fixed a bug related to vulnerability processing for mac office apps.
2023-03-06 15:07:27 -04:00

31 lines
646 B
Go

package macoffice
import (
"context"
"os"
"testing"
"time"
"github.com/fleetdm/fleet/v4/pkg/nettest"
"github.com/fleetdm/fleet/v4/server/vulnerabilities/io"
"github.com/stretchr/testify/require"
)
func TestIntegrationSync(t *testing.T) {
nettest.Run(t)
vulnPath := t.TempDir()
ctx := context.Background()
err := SyncFromGithub(ctx, vulnPath)
require.NoError(t, err)
entries, err := os.ReadDir(vulnPath)
var filesInVulnPath []string
for _, e := range entries {
filesInVulnPath = append(filesInVulnPath, e.Name())
}
require.NoError(t, err)
require.Contains(t, filesInVulnPath, io.MacOfficeRelNotesFileName(time.Now()))
}