Skip to content

Commit

Permalink
continue fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
attiasas committed Sep 24, 2024
1 parent 5689bdb commit 16b9392
Show file tree
Hide file tree
Showing 7 changed files with 3,051 additions and 1,450 deletions.
778 changes: 778 additions & 0 deletions jobTestData/debug/sarif.json

Large diffs are not rendered by default.

826 changes: 826 additions & 0 deletions jobTestData/debug/simple.json

Large diffs are not rendered by default.

1,416 changes: 708 additions & 708 deletions tests/testdata/output/dockerscan/docker_sarif.json

Large diffs are not rendered by default.

1,450 changes: 725 additions & 725 deletions tests/testdata/output/dockerscan/docker_simple_json.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions utils/formats/sarifutils/test_sarifutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func CreateRunWithDummyResultAndRuleProperties(result *sarif.Result, properties,
if rule == nil {
return nil
}
rule.Properties = map[string]interface{}{}
for index := range properties {
rule.Properties[properties[index]] = values[index]
}
Expand Down
8 changes: 2 additions & 6 deletions utils/results/conversion/convertor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package conversion

import (
"fmt"
"os"
"path/filepath"
"testing"

"github.com/jfrog/jfrog-cli-security/utils"
"github.com/jfrog/jfrog-cli-security/utils/formats"
"github.com/jfrog/jfrog-client-go/utils/log"

testUtils "github.com/jfrog/jfrog-cli-security/tests/utils"
"github.com/jfrog/jfrog-cli-security/utils/results"
Expand Down Expand Up @@ -135,7 +135,7 @@ func validateSimpleJsonConversion(t *testing.T, expectedResults formats.SimpleJs
return
}
validationParams.Actual = actualResults

validations.ValidateCommandSimpleJsonOutput(t, validationParams)
}

Expand All @@ -148,10 +148,6 @@ func validateSarifConversion(t *testing.T, expectedResults *sarif.Report, inputR
}
validationParams.Actual = actualResults

marshAct, err := utils.GetAsJsonString(actualResults, false, true)
assert.NoError(t, err)
log.Output(marshAct)

validations.ValidateCommandSarifOutput(t, validationParams)
}

Expand Down
22 changes: 11 additions & 11 deletions utils/results/conversion/simplejsonparser/simplejsonparser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ func TestPrepareSimpleJsonVulnerabilities(t *testing.T) {
IssueId: "XRAY-1",
Cves: []formats.CveRow{{Id: "CVE-1"}},
ImpactedDependencyDetails: formats.ImpactedDependencyDetails{
SeverityDetails: formats.SeverityDetails{Severity: "High", SeverityNumValue: 15},
SeverityDetails: formats.SeverityDetails{Severity: "High", SeverityNumValue: 18},
ImpactedDependencyName: "component-A",
// Direct
Components: []formats.ComponentRow{{
Expand All @@ -303,7 +303,7 @@ func TestPrepareSimpleJsonVulnerabilities(t *testing.T) {
IssueId: "XRAY-1",
Cves: []formats.CveRow{{Id: "CVE-1"}},
ImpactedDependencyDetails: formats.ImpactedDependencyDetails{
SeverityDetails: formats.SeverityDetails{Severity: "High", SeverityNumValue: 15},
SeverityDetails: formats.SeverityDetails{Severity: "High", SeverityNumValue: 18},
ImpactedDependencyName: "component-B",
// Direct
Components: []formats.ComponentRow{{
Expand All @@ -318,7 +318,7 @@ func TestPrepareSimpleJsonVulnerabilities(t *testing.T) {
IssueId: "XRAY-2",
Cves: []formats.CveRow{{Id: "CVE-2"}},
ImpactedDependencyDetails: formats.ImpactedDependencyDetails{
SeverityDetails: formats.SeverityDetails{Severity: "Low", SeverityNumValue: 9},
SeverityDetails: formats.SeverityDetails{Severity: "Low", SeverityNumValue: 10},
ImpactedDependencyName: "component-B",
// Direct
Components: []formats.ComponentRow{{
Expand Down Expand Up @@ -393,7 +393,7 @@ func TestPrepareSimpleJsonVulnerabilities(t *testing.T) {
},
}},
ImpactedDependencyDetails: formats.ImpactedDependencyDetails{
SeverityDetails: formats.SeverityDetails{Severity: "Low", SeverityNumValue: 11},
SeverityDetails: formats.SeverityDetails{Severity: "Low", SeverityNumValue: 13},
ImpactedDependencyName: "component-B",
// Direct
Components: []formats.ComponentRow{{
Expand Down Expand Up @@ -441,7 +441,7 @@ func TestPrepareSimpleJsonViolations(t *testing.T) {
IssueId: "XRAY-1",
Cves: []formats.CveRow{{Id: "CVE-1"}},
ImpactedDependencyDetails: formats.ImpactedDependencyDetails{
SeverityDetails: formats.SeverityDetails{Severity: "High", SeverityNumValue: 15},
SeverityDetails: formats.SeverityDetails{Severity: "High", SeverityNumValue: 18},
ImpactedDependencyName: "component-A",
// Direct
Components: []formats.ComponentRow{{
Expand All @@ -456,7 +456,7 @@ func TestPrepareSimpleJsonViolations(t *testing.T) {
IssueId: "XRAY-1",
Cves: []formats.CveRow{{Id: "CVE-1"}},
ImpactedDependencyDetails: formats.ImpactedDependencyDetails{
SeverityDetails: formats.SeverityDetails{Severity: "High", SeverityNumValue: 15},
SeverityDetails: formats.SeverityDetails{Severity: "High", SeverityNumValue: 18},
ImpactedDependencyName: "component-B",
// Direct
Components: []formats.ComponentRow{{
Expand All @@ -471,7 +471,7 @@ func TestPrepareSimpleJsonViolations(t *testing.T) {
IssueId: "XRAY-2",
Cves: []formats.CveRow{{Id: "CVE-2"}},
ImpactedDependencyDetails: formats.ImpactedDependencyDetails{
SeverityDetails: formats.SeverityDetails{Severity: "Low", SeverityNumValue: 9},
SeverityDetails: formats.SeverityDetails{Severity: "Low", SeverityNumValue: 10},
ImpactedDependencyName: "component-B",
// Direct
Components: []formats.ComponentRow{{
Expand All @@ -486,7 +486,7 @@ func TestPrepareSimpleJsonViolations(t *testing.T) {
{
LicenseKey: "license-1",
ImpactedDependencyDetails: formats.ImpactedDependencyDetails{
SeverityDetails: formats.SeverityDetails{Severity: "Low", SeverityNumValue: 9},
SeverityDetails: formats.SeverityDetails{Severity: "Low", SeverityNumValue: 10},
ImpactedDependencyName: "component-B",
Components: []formats.ComponentRow{{Name: "component-B", Location: &formats.Location{File: "target"}}},
},
Expand Down Expand Up @@ -556,7 +556,7 @@ func TestPrepareSimpleJsonViolations(t *testing.T) {
},
}},
ImpactedDependencyDetails: formats.ImpactedDependencyDetails{
SeverityDetails: formats.SeverityDetails{Severity: "Low", SeverityNumValue: 11},
SeverityDetails: formats.SeverityDetails{Severity: "Low", SeverityNumValue: 13},
ImpactedDependencyName: "component-B",
// Direct
Components: []formats.ComponentRow{{
Expand All @@ -571,7 +571,7 @@ func TestPrepareSimpleJsonViolations(t *testing.T) {
{
LicenseKey: "license-1",
ImpactedDependencyDetails: formats.ImpactedDependencyDetails{
SeverityDetails: formats.SeverityDetails{Severity: "Low", SeverityNumValue: 9},
SeverityDetails: formats.SeverityDetails{Severity: "Low", SeverityNumValue: 10},
ImpactedDependencyName: "component-B",
// Direct
Components: []formats.ComponentRow{{
Expand Down Expand Up @@ -682,7 +682,7 @@ func TestPrepareSimpleJsonJasIssues(t *testing.T) {
expectedOutput: []formats.SourceCodeRow{
{
Location: formats.Location{File: "file", StartLine: 1, StartColumn: 2, EndLine: 3, EndColumn: 4, Snippet: "secret-snippet"},
SeverityDetails: formats.SeverityDetails{Severity: "Low", SeverityNumValue: 11},
SeverityDetails: formats.SeverityDetails{Severity: "Low", SeverityNumValue: 13},
},
},
},
Expand Down

0 comments on commit 16b9392

Please sign in to comment.