From 4444ea73eac46dc4dc4d57a7cffd7343418cb811 Mon Sep 17 00:00:00 2001 From: attiasas Date: Mon, 18 Dec 2023 11:10:43 +0200 Subject: [PATCH] update changes to formatoutput --- buildtools/cli.go | 5 ++-- go.mod | 6 ++-- go.sum | 12 ++++---- main_test.go | 6 ++-- scan/cli.go | 14 ++++----- xray_test.go | 75 ++++++++++++++++++++++++----------------------- 6 files changed, 60 insertions(+), 58 deletions(-) diff --git a/buildtools/cli.go b/buildtools/cli.go index 1fbc9ba94..a5eea83b2 100644 --- a/buildtools/cli.go +++ b/buildtools/cli.go @@ -20,6 +20,7 @@ import ( containerutils "github.com/jfrog/jfrog-cli-core/v2/artifactory/utils/container" "github.com/jfrog/jfrog-cli-core/v2/common/build" "github.com/jfrog/jfrog-cli-core/v2/common/commands" + outputFormat "github.com/jfrog/jfrog-cli-core/v2/common/format" "github.com/jfrog/jfrog-cli-core/v2/common/project" corecommon "github.com/jfrog/jfrog-cli-core/v2/docs/common" coreConfig "github.com/jfrog/jfrog-cli-core/v2/utils/config" @@ -417,7 +418,7 @@ func MvnCmd(c *cli.Context) (err error) { if !xrayScan && format != "" { return cliutils.PrintHelpAndReturnError("The --format option can be sent only with the --scan option", c) } - scanOutputFormat, err := commandsUtils.GetXrayOutputFormat(format) + scanOutputFormat, err := outputFormat.GetOutputFormat(format) if err != nil { return err } @@ -469,7 +470,7 @@ func GradleCmd(c *cli.Context) (err error) { if !xrayScan && format != "" { return cliutils.PrintHelpAndReturnError("The --format option can be sent only with the --scan option", c) } - scanOutputFormat, err := commandsUtils.GetXrayOutputFormat(format) + scanOutputFormat, err := outputFormat.GetOutputFormat(format) if err != nil { return err } diff --git a/go.mod b/go.mod index 3de39f17f..b287db9b9 100644 --- a/go.mod +++ b/go.mod @@ -7,10 +7,10 @@ require ( github.com/buger/jsonparser v1.1.1 github.com/go-git/go-git/v5 v5.9.0 github.com/gocarina/gocsv v0.0.0-20230616125104-99d496ca653d - github.com/jfrog/build-info-go v1.9.16 + github.com/jfrog/build-info-go v1.9.17 github.com/jfrog/gofrog v1.3.2 github.com/jfrog/jfrog-cli-core/v2 v2.47.3 - github.com/jfrog/jfrog-client-go v1.35.0 + github.com/jfrog/jfrog-client-go v1.35.1 github.com/jszwec/csvutil v1.8.0 github.com/mholt/archiver/v3 v3.5.1 github.com/stretchr/testify v1.8.4 @@ -132,7 +132,7 @@ require ( // replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go v1.8.9-0.20231130093251-25c79868c10c -replace github.com/jfrog/jfrog-cli-core/v2 => github.com/attiasas/jfrog-cli-core/v2 v2.0.0-20231214131551-dc1531890f85 +replace github.com/jfrog/jfrog-cli-core/v2 => github.com/attiasas/jfrog-cli-core/v2 v2.0.0-20231218090316-b2d517258419 // replace github.com/jfrog/gofrog => github.com/jfrog/gofrog v1.3.2-0.20231130091721-6d742be8bc7a diff --git a/go.sum b/go.sum index 229b1d71f..e074f1ba2 100644 --- a/go.sum +++ b/go.sum @@ -69,8 +69,8 @@ github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkE github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q= github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= -github.com/attiasas/jfrog-cli-core/v2 v2.0.0-20231214131551-dc1531890f85 h1:hwxs4zOuDbM2w1U4bBAyH+bNtWu59FVtGg6m9FuDQ+c= -github.com/attiasas/jfrog-cli-core/v2 v2.0.0-20231214131551-dc1531890f85/go.mod h1:RFQwrZ1qXAQ+X0xfuzxBBDIYuRnDsPy12xlyjuOpUog= +github.com/attiasas/jfrog-cli-core/v2 v2.0.0-20231218090316-b2d517258419 h1:y+tDVgrjqEw3yov6mEhCoNLKy5rITLBO+7OMcSxr59g= +github.com/attiasas/jfrog-cli-core/v2 v2.0.0-20231218090316-b2d517258419/go.mod h1:6UImGTYUkxOxst/M4wSp6G7dnI24h0OkDW8BnXYhtCE= github.com/bradleyjkemp/cupaloy/v2 v2.8.0 h1:any4BmKE+jGIaMpnU8YgH/I2LPiLBufr6oMMlVBbn9M= github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs= github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= @@ -239,14 +239,14 @@ github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOl github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jedib0t/go-pretty/v6 v6.4.0 h1:YlI/2zYDrweA4MThiYMKtGRfT+2qZOO65ulej8GTcVI= github.com/jedib0t/go-pretty/v6 v6.4.0/go.mod h1:MgmISkTWDSFu0xOqiZ0mKNntMQ2mDgOcwOkwBEkMDJI= -github.com/jfrog/build-info-go v1.9.16 h1:zMNxUXve4CZndhlbaEGwgayWPY8CRyPzSobvTKYRPcg= -github.com/jfrog/build-info-go v1.9.16/go.mod h1:/5VZXH2Ud0IK3cOFwPykjwPOaEcHhzzbjnRiou+YKpM= +github.com/jfrog/build-info-go v1.9.17 h1:sUA6V3P8i+awYlK7dkwm4l6IuLE2W964F5Pb18x95HA= +github.com/jfrog/build-info-go v1.9.17/go.mod h1:/5VZXH2Ud0IK3cOFwPykjwPOaEcHhzzbjnRiou+YKpM= github.com/jfrog/gofrog v1.3.2 h1:TktKP+PdZdxjkYZxWWIq4DkTGSYtr9Slsy+egZpEhUY= github.com/jfrog/gofrog v1.3.2/go.mod h1:AQo5Fq0G9nDEF6icH7MYQK0iohR4HuEAXl8jaxRuT6Q= github.com/jfrog/jfrog-apps-config v1.0.1 h1:mtv6k7g8A8BVhlHGlSveapqf4mJfonwvXYLipdsOFMY= github.com/jfrog/jfrog-apps-config v1.0.1/go.mod h1:8AIIr1oY9JuH5dylz2S6f8Ym2MaadPLR6noCBO4C22w= -github.com/jfrog/jfrog-client-go v1.35.0 h1:VTyrR/jFlWInRdGYswa2fwFc1Thsh6eGMnHuqhDVh7s= -github.com/jfrog/jfrog-client-go v1.35.0/go.mod h1:cG0vdKXbyfupKgSYmwA5FZPco6zSfyJi3eEYOxuqm/k= +github.com/jfrog/jfrog-client-go v1.35.1 h1:T5HXyRykSCx4cZ//9VCnvHs5rvsPCuNsTU4+CRvkVWk= +github.com/jfrog/jfrog-client-go v1.35.1/go.mod h1:XF/PXHuKILfB1sN3n903yWaWJKJX5VYofDGvO9cJ3+g= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jszwec/csvutil v1.8.0 h1:G7vS2LGdpZZDH1HmHeNbxOaJ/ZnJlpwGFvOkTkJzzNk= diff --git a/main_test.go b/main_test.go index 1a0fe2838..4947aaeed 100644 --- a/main_test.go +++ b/main_test.go @@ -13,13 +13,13 @@ import ( buildinfo "github.com/jfrog/build-info-go/entities" commandUtils "github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/utils" "github.com/jfrog/jfrog-cli-core/v2/common/commands" + "github.com/jfrog/jfrog-cli-core/v2/common/format" "github.com/jfrog/jfrog-cli-core/v2/common/project" "github.com/jfrog/jfrog-cli-core/v2/common/spec" "github.com/jfrog/jfrog-cli-core/v2/utils/config" "github.com/jfrog/jfrog-cli-core/v2/utils/coreutils" "github.com/jfrog/jfrog-cli-core/v2/utils/log" coreTests "github.com/jfrog/jfrog-cli-core/v2/utils/tests" - xrayutils "github.com/jfrog/jfrog-cli-core/v2/xray/utils" "github.com/jfrog/jfrog-cli/artifactory" "github.com/jfrog/jfrog-cli/inttestutils" "github.com/jfrog/jfrog-cli/utils/tests" @@ -279,14 +279,14 @@ func validateCmdAliasesUniqueness() { func testConditionalUpload(t *testing.T, execFunc func() error, searchSpec string, expectedDeployed ...string) { // Mock the scan function (failure) and verify the expected error returned. expectedErrMsg := "This error was expected" - commandUtils.ConditionalUploadScanFunc = func(serverDetails *config.ServerDetails, fileSpec *spec.SpecFiles, threads int, scanOutputFormat xrayutils.OutputFormat) error { + commandUtils.ConditionalUploadScanFunc = func(serverDetails *config.ServerDetails, fileSpec *spec.SpecFiles, threads int, scanOutputFormat format.OutputFormat) error { return errors.New(expectedErrMsg) } err := execFunc() assert.EqualError(t, err, expectedErrMsg) inttestutils.VerifyExistInArtifactory(nil, searchSpec, serverDetails, t) // Mock the scan function (success) and verify the expected artifacts deployed. - commandUtils.ConditionalUploadScanFunc = func(serverDetails *config.ServerDetails, fileSpec *spec.SpecFiles, threads int, scanOutputFormat xrayutils.OutputFormat) error { + commandUtils.ConditionalUploadScanFunc = func(serverDetails *config.ServerDetails, fileSpec *spec.SpecFiles, threads int, scanOutputFormat format.OutputFormat) error { return nil } err = execFunc() diff --git a/scan/cli.go b/scan/cli.go index 371a93af8..43301312c 100644 --- a/scan/cli.go +++ b/scan/cli.go @@ -9,8 +9,8 @@ import ( "github.com/jfrog/jfrog-cli/utils/progressbar" - commandsutils "github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/utils" "github.com/jfrog/jfrog-cli-core/v2/common/commands" + outputFormat "github.com/jfrog/jfrog-cli-core/v2/common/format" "github.com/jfrog/jfrog-cli-core/v2/common/spec" corecommondocs "github.com/jfrog/jfrog-cli-core/v2/docs/common" coreconfig "github.com/jfrog/jfrog-cli-core/v2/utils/config" @@ -219,7 +219,7 @@ func CurationCmd(c *cli.Context) error { if err != nil { return err } - format, err := commandsutils.GetCurationOutputFormat(c.String("format")) + format, err := curation.GetCurationOutputFormat(c.String("format")) if err != nil { return err } @@ -243,7 +243,7 @@ func createAuditCmd(c *cli.Context) (*audit.AuditCommand, error) { if err != nil { return nil, err } - format, err := commandsutils.GetXrayOutputFormat(c.String("format")) + format, err := outputFormat.GetOutputFormat(c.String("format")) if err != nil { return nil, err } @@ -308,7 +308,7 @@ func ScanCmd(c *cli.Context) error { if err != nil { return err } - format, err := commandsutils.GetXrayOutputFormat(c.String("format")) + format, err := outputFormat.GetOutputFormat(c.String("format")) if err != nil { return err } @@ -353,7 +353,7 @@ func BuildScan(c *cli.Context) error { if err != nil { return err } - format, err := commandsutils.GetXrayOutputFormat(c.String("format")) + format, err := outputFormat.GetOutputFormat(c.String("format")) if err != nil { return err } @@ -364,7 +364,7 @@ func BuildScan(c *cli.Context) error { SetOutputFormat(format). SetPrintExtendedTable(c.Bool(cliutils.ExtendedTable)). SetRescan(c.Bool("rescan")) - if format != xrutils.Sarif { + if format != outputFormat.Sarif { // Sarif shouldn't include the additional all-vulnerabilities info that received by adding the vuln flag buildScanCmd.SetIncludeVulnerabilities(c.Bool("vuln")) } @@ -387,7 +387,7 @@ func DockerScan(c *cli.Context, image string) error { return err } containerScanCommand := scan.NewDockerScanCommand() - format, err := commandsutils.GetXrayOutputFormat(c.String("format")) + format, err := outputFormat.GetOutputFormat(c.String("format")) if err != nil { return err } diff --git a/xray_test.go b/xray_test.go index 5cb5c3831..cb9aff7ce 100644 --- a/xray_test.go +++ b/xray_test.go @@ -26,6 +26,7 @@ import ( "github.com/jfrog/jfrog-cli-core/v2/artifactory/utils/container" "github.com/jfrog/jfrog-cli-core/v2/common/build" coreCmd "github.com/jfrog/jfrog-cli-core/v2/common/commands" + "github.com/jfrog/jfrog-cli-core/v2/common/format" "github.com/jfrog/jfrog-cli-core/v2/common/project" commontests "github.com/jfrog/jfrog-cli-core/v2/common/tests" "github.com/jfrog/jfrog-cli-core/v2/utils/config" @@ -101,26 +102,26 @@ func initXrayCli() { // Tests basic binary scan by providing pattern (path to testdata binaries) and --licenses flag // and asserts any error. func TestXrayBinaryScanJson(t *testing.T) { - output := testXrayBinaryScan(t, string(utils.Json)) + output := testXrayBinaryScan(t, string(format.Json)) verifyJsonScanResults(t, output, 0, 1, 1) } func TestXrayBinaryScanSimpleJson(t *testing.T) { - output := testXrayBinaryScan(t, string(utils.SimpleJson)) + output := testXrayBinaryScan(t, string(format.SimpleJson)) verifySimpleJsonScanResults(t, output, 1, 1) } func TestXrayBinaryScanJsonWithProgress(t *testing.T) { callback := tests.MockProgressInitialization() defer callback() - output := testXrayBinaryScan(t, string(utils.Json)) + output := testXrayBinaryScan(t, string(format.Json)) verifyJsonScanResults(t, output, 0, 1, 1) } func TestXrayBinaryScanSimpleJsonWithProgress(t *testing.T) { callback := tests.MockProgressInitialization() defer callback() - output := testXrayBinaryScan(t, string(utils.SimpleJson)) + output := testXrayBinaryScan(t, string(format.SimpleJson)) verifySimpleJsonScanResults(t, output, 1, 1) } @@ -149,12 +150,12 @@ func TestXrayBinaryScanWithBypassArchiveLimits(t *testing.T) { // Tests npm audit by providing simple npm project and asserts any error. func TestXrayAuditNpmJson(t *testing.T) { - output := testXrayAuditNpm(t, string(utils.Json)) + output := testXrayAuditNpm(t, string(format.Json)) verifyJsonScanResults(t, output, 0, 1, 1) } func TestXrayAuditNpmSimpleJson(t *testing.T) { - output := testXrayAuditNpm(t, string(utils.SimpleJson)) + output := testXrayAuditNpm(t, string(format.SimpleJson)) verifySimpleJsonScanResults(t, output, 1, 1) } @@ -176,21 +177,21 @@ func testXrayAuditNpm(t *testing.T, format string) string { func TestXrayAuditYarnV2Json(t *testing.T) { testXrayAuditYarn(t, "yarn-v2", func() { - output := runXrayAuditYarnWithOutput(t, string(utils.Json)) + output := runXrayAuditYarnWithOutput(t, string(format.Json)) verifyJsonScanResults(t, output, 0, 1, 1) }) } func TestXrayAuditYarnV2SimpleJson(t *testing.T) { testXrayAuditYarn(t, "yarn-v2", func() { - output := runXrayAuditYarnWithOutput(t, string(utils.SimpleJson)) + output := runXrayAuditYarnWithOutput(t, string(format.SimpleJson)) verifySimpleJsonScanResults(t, output, 1, 1) }) } func TestXrayAuditYarnV1Json(t *testing.T) { testXrayAuditYarn(t, "yarn-v1", func() { - output := runXrayAuditYarnWithOutput(t, string(utils.Json)) + output := runXrayAuditYarnWithOutput(t, string(format.Json)) verifyJsonScanResults(t, output, 0, 1, 1) }) } @@ -199,7 +200,7 @@ func TestXrayAuditYarnV1JsonWithoutDevDependencies(t *testing.T) { unsetEnv := clientTestUtils.SetEnvWithCallbackAndAssert(t, "NODE_ENV", "production") defer unsetEnv() testXrayAuditYarn(t, "yarn-v1", func() { - output := runXrayAuditYarnWithOutput(t, string(utils.Json)) + output := runXrayAuditYarnWithOutput(t, string(format.Json)) var results []services.ScanResponse err := json.Unmarshal([]byte(output), &results) assert.NoError(t, err) @@ -209,7 +210,7 @@ func TestXrayAuditYarnV1JsonWithoutDevDependencies(t *testing.T) { func TestXrayAuditYarnV1SimpleJson(t *testing.T) { testXrayAuditYarn(t, "yarn-v1", func() { - output := runXrayAuditYarnWithOutput(t, string(utils.SimpleJson)) + output := runXrayAuditYarnWithOutput(t, string(format.SimpleJson)) verifySimpleJsonScanResults(t, output, 1, 1) }) } @@ -245,35 +246,35 @@ func TestXrayAuditNugetJson(t *testing.T) { }{ { projectName: "single4.0", - format: string(utils.Json), + format: string(format.Json), restoreTech: "nuget", minVulnerabilities: 2, minLicences: 0, }, { projectName: "single5.0", - format: string(utils.Json), + format: string(format.Json), restoreTech: "dotnet", minVulnerabilities: 3, minLicences: 2, }, { projectName: "single5.0", - format: string(utils.Json), + format: string(format.Json), restoreTech: "", minVulnerabilities: 3, minLicences: 2, }, { projectName: "multi", - format: string(utils.Json), + format: string(format.Json), restoreTech: "dotnet", minVulnerabilities: 5, minLicences: 3, }, { projectName: "multi", - format: string(utils.Json), + format: string(format.Json), restoreTech: "", minVulnerabilities: 5, minLicences: 3, @@ -299,21 +300,21 @@ func TestXrayAuditNugetSimpleJson(t *testing.T) { }{ { projectName: "single4.0", - format: string(utils.SimpleJson), + format: string(format.SimpleJson), restoreTech: "nuget", minVulnerabilities: 2, minLicences: 0, }, { projectName: "single5.0", - format: string(utils.SimpleJson), + format: string(format.SimpleJson), restoreTech: "dotnet", minVulnerabilities: 3, minLicences: 2, }, { projectName: "single5.0", - format: string(utils.SimpleJson), + format: string(format.SimpleJson), restoreTech: "", minVulnerabilities: 3, minLicences: 2, @@ -349,12 +350,12 @@ func testXrayAuditNuget(t *testing.T, projectName, format string, restoreTech st } func TestXrayAuditGradleJson(t *testing.T) { - output := testXrayAuditGradle(t, string(utils.Json)) + output := testXrayAuditGradle(t, string(format.Json)) verifyJsonScanResults(t, output, 0, 3, 3) } func TestXrayAuditGradleSimpleJson(t *testing.T) { - output := testXrayAuditGradle(t, string(utils.SimpleJson)) + output := testXrayAuditGradle(t, string(format.SimpleJson)) verifySimpleJsonScanResults(t, output, 3, 3) } @@ -373,12 +374,12 @@ func testXrayAuditGradle(t *testing.T, format string) string { } func TestXrayAuditMavenJson(t *testing.T) { - output := testXrayAuditMaven(t, string(utils.Json)) + output := testXrayAuditMaven(t, string(format.Json)) verifyJsonScanResults(t, output, 0, 1, 1) } func TestXrayAuditMavenSimpleJson(t *testing.T) { - output := testXrayAuditMaven(t, string(utils.SimpleJson)) + output := testXrayAuditMaven(t, string(format.SimpleJson)) verifySimpleJsonScanResults(t, output, 1, 1) } @@ -417,7 +418,7 @@ func TestXrayAuditDetectTech(t *testing.T) { prevWd := changeWD(t, tempDirPath) defer clientTestUtils.ChangeDirAndAssert(t, prevWd) // Run generic audit on mvn project with a vulnerable dependency - output := xrayCli.RunCliCmdWithOutput(t, "audit", "--licenses", "--format="+string(utils.SimpleJson)) + output := xrayCli.RunCliCmdWithOutput(t, "audit", "--licenses", "--format="+string(format.SimpleJson)) var results formats.SimpleJsonResults err := json.Unmarshal([]byte(output), &results) assert.NoError(t, err) @@ -440,28 +441,28 @@ func TestXrayAuditMultiProjects(t *testing.T) { // Configure a new server named "default" createJfrogHomeConfig(t, true) defer cleanTestsHomeEnv() - output := xrayCli.WithoutCredentials().RunCliCmdWithOutput(t, "audit", "--format="+string(utils.SimpleJson), workingDirsFlag) + output := xrayCli.WithoutCredentials().RunCliCmdWithOutput(t, "audit", "--format="+string(format.SimpleJson), workingDirsFlag) verifySimpleJsonScanResults(t, output, 35, 0) verifySimpleJsonJasResults(t, output, 1, 9, 7, 3) } func TestXrayAuditPipJson(t *testing.T) { - output := testXrayAuditPip(t, string(utils.Json), "") + output := testXrayAuditPip(t, string(format.Json), "") verifyJsonScanResults(t, output, 0, 3, 1) } func TestXrayAuditPipSimpleJson(t *testing.T) { - output := testXrayAuditPip(t, string(utils.SimpleJson), "") + output := testXrayAuditPip(t, string(format.SimpleJson), "") verifySimpleJsonScanResults(t, output, 3, 1) } func TestXrayAuditPipJsonWithRequirementsFile(t *testing.T) { - output := testXrayAuditPip(t, string(utils.Json), "requirements.txt") + output := testXrayAuditPip(t, string(format.Json), "requirements.txt") verifyJsonScanResults(t, output, 0, 2, 0) } func TestXrayAuditPipSimpleJsonWithRequirementsFile(t *testing.T) { - output := testXrayAuditPip(t, string(utils.SimpleJson), "requirements.txt") + output := testXrayAuditPip(t, string(format.SimpleJson), "requirements.txt") verifySimpleJsonScanResults(t, output, 2, 0) } @@ -485,12 +486,12 @@ func testXrayAuditPip(t *testing.T, format, requirementsFile string) string { } func TestXrayAuditPipenvJson(t *testing.T) { - output := testXrayAuditPipenv(t, string(utils.Json)) + output := testXrayAuditPipenv(t, string(format.Json)) verifyJsonScanResults(t, output, 0, 3, 1) } func TestXrayAuditPipenvSimpleJson(t *testing.T) { - output := testXrayAuditPipenv(t, string(utils.SimpleJson)) + output := testXrayAuditPipenv(t, string(format.SimpleJson)) verifySimpleJsonScanResults(t, output, 3, 1) } @@ -547,12 +548,12 @@ func TestDownloadAnalyzerManagerIfNeeded(t *testing.T) { } func TestXrayAuditPoetryJson(t *testing.T) { - output := testXrayAuditPoetry(t, string(utils.Json)) + output := testXrayAuditPoetry(t, string(format.Json)) verifyJsonScanResults(t, output, 0, 3, 1) } func TestXrayAuditPoetrySimpleJson(t *testing.T) { - output := testXrayAuditPoetry(t, string(utils.SimpleJson)) + output := testXrayAuditPoetry(t, string(format.SimpleJson)) verifySimpleJsonScanResults(t, output, 3, 1) } @@ -774,17 +775,17 @@ func TestXrayOfflineDBSyncV3(t *testing.T) { } func TestXrayAuditJasSimpleJson(t *testing.T) { - output := testXrayAuditJas(t, string(utils.SimpleJson), "jas-test") + output := testXrayAuditJas(t, string(format.SimpleJson), "jas-test") verifySimpleJsonJasResults(t, output, 1, 9, 7, 2) } func TestXrayAuditJasSimpleJsonWithConfig(t *testing.T) { - output := testXrayAuditJas(t, string(utils.SimpleJson), "jas-config") + output := testXrayAuditJas(t, string(format.SimpleJson), "jas-config") verifySimpleJsonJasResults(t, output, 0, 0, 1, 2) } func TestXrayAuditJasNoViolationsSimpleJson(t *testing.T) { - output := testXrayAuditJas(t, string(utils.SimpleJson), "npm") + output := testXrayAuditJas(t, string(format.SimpleJson), "npm") verifySimpleJsonScanResults(t, output, 2, 0) verifySimpleJsonJasResults(t, output, 0, 0, 0, 0) } @@ -869,7 +870,7 @@ func TestCurationAudit(t *testing.T) { localXrayCli := xrayCli.WithoutCredentials() workingDirsFlag := fmt.Sprintf("--working-dirs=%s", filepath.Join(tempDirPath, "npm")) - output := localXrayCli.RunCliCmdWithOutput(t, "curation-audit", "--format="+string(utils.Json), workingDirsFlag) + output := localXrayCli.RunCliCmdWithOutput(t, "curation-audit", "--format="+string(format.Json), workingDirsFlag) expectedResp := getCurationExpectedResponse(config) var got []coreCuration.PackageStatus bracketIndex := strings.Index(output, "[")