Skip to content

Commit d2f4729

Browse files
committed
fixed the integration test and the unit test of severity counter
1 parent afcf467 commit d2f4729

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

integrationutils.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,19 @@ func setIntegrationTestEnvs(t *testing.T, testDetails *IntegrationTestDetails) f
7676
// so we restore them at the end of the test to avoid collisions with other tests
7777
envRestoreFunc := getJfrogEnvRestoreFunc(t)
7878
unsetEnvs := utils.SetEnvsAndAssertWithCallback(t, map[string]string{
79-
utils.RequirementsFileEnv: "requirements.txt",
80-
utils.GitPullRequestIDEnv: testDetails.PullRequestID,
81-
utils.GitProvider: testDetails.GitProvider,
82-
utils.GitTokenEnv: testDetails.GitToken,
83-
utils.GitRepoEnv: testDetails.RepoName,
84-
utils.GitRepoOwnerEnv: testDetails.RepoOwner,
85-
utils.BranchNameTemplateEnv: testDetails.CustomBranchName,
86-
utils.GitApiEndpointEnv: testDetails.ApiEndpoint,
87-
utils.GitProjectEnv: testDetails.GitProject,
88-
utils.GitUsernameEnv: testDetails.GitUsername,
89-
utils.GitBaseBranchEnv: mainBranch,
90-
utils.GitUseLocalRepositoryEnv: fmt.Sprintf("%t", testDetails.UseLocalRepo),
79+
utils.RequirementsFileEnv: "requirements.txt",
80+
utils.GitPullRequestIDEnv: testDetails.PullRequestID,
81+
utils.GitProvider: testDetails.GitProvider,
82+
utils.GitTokenEnv: testDetails.GitToken,
83+
utils.GitRepoEnv: testDetails.RepoName,
84+
utils.GitRepoOwnerEnv: testDetails.RepoOwner,
85+
utils.BranchNameTemplateEnv: testDetails.CustomBranchName,
86+
utils.GitApiEndpointEnv: testDetails.ApiEndpoint,
87+
utils.GitProjectEnv: testDetails.GitProject,
88+
utils.GitUsernameEnv: testDetails.GitUsername,
89+
utils.GitBaseBranchEnv: mainBranch,
90+
utils.GitUseLocalRepositoryEnv: fmt.Sprintf("%t", testDetails.UseLocalRepo),
91+
utils.IncludeVulnerabilitiesEnv: "TRUE",
9192
})
9293
return func() {
9394
envRestoreFunc()

scanpullrequest/scanpullrequest_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func TestScanResultsToIssuesCollection(t *testing.T) {
9898
Applicable: "Applicable",
9999
FixedVersions: []string{"1.2.3"},
100100
ImpactedDependencyDetails: formats.ImpactedDependencyDetails{
101-
SeverityDetails: formats.SeverityDetails{Severity: "High", SeverityNumValue: 21},
101+
SeverityDetails: formats.SeverityDetails{Severity: "High", SeverityNumValue: 26},
102102
ImpactedDependencyName: "Dep-1",
103103
},
104104
Cves: []formats.CveRow{{Id: "CVE-2022-2122", Applicability: &formats.Applicability{Status: "Applicable", ScannerDescription: "rule-msg", Evidence: []formats.Evidence{{Reason: "result-msg", Location: formats.Location{File: "file1", StartLine: 1, StartColumn: 10, EndLine: 2, EndColumn: 11, Snippet: "snippet"}}}}}},
@@ -107,7 +107,7 @@ func TestScanResultsToIssuesCollection(t *testing.T) {
107107
Applicable: "Not Applicable",
108108
FixedVersions: []string{"1.2.2"},
109109
ImpactedDependencyDetails: formats.ImpactedDependencyDetails{
110-
SeverityDetails: formats.SeverityDetails{Severity: "Low", SeverityNumValue: 2},
110+
SeverityDetails: formats.SeverityDetails{Severity: "Low", SeverityNumValue: 3},
111111
ImpactedDependencyName: "Dep-2",
112112
},
113113
Cves: []formats.CveRow{{Id: "CVE-2023-3122", Applicability: &formats.Applicability{Status: "Not Applicable", ScannerDescription: "rule-msg"}}},
@@ -117,7 +117,7 @@ func TestScanResultsToIssuesCollection(t *testing.T) {
117117
{
118118
SeverityDetails: formats.SeverityDetails{
119119
Severity: "High",
120-
SeverityNumValue: 21,
120+
SeverityNumValue: 26,
121121
},
122122
ScannerInfo: formats.ScannerInfo{
123123
ScannerDescription: "rule-msg",
@@ -138,7 +138,7 @@ func TestScanResultsToIssuesCollection(t *testing.T) {
138138
{
139139
SeverityDetails: formats.SeverityDetails{
140140
Severity: "High",
141-
SeverityNumValue: 21,
141+
SeverityNumValue: 26,
142142
},
143143
ScannerInfo: formats.ScannerInfo{
144144
ScannerDescription: "rule-msg",
@@ -159,7 +159,7 @@ func TestScanResultsToIssuesCollection(t *testing.T) {
159159
{
160160
SeverityDetails: formats.SeverityDetails{
161161
Severity: "High",
162-
SeverityNumValue: 21,
162+
SeverityNumValue: 26,
163163
},
164164
ScannerInfo: formats.ScannerInfo{
165165
ScannerDescription: "rule-msg",
@@ -183,7 +183,7 @@ func TestScanResultsToIssuesCollection(t *testing.T) {
183183
ImpactedDependencyDetails: formats.ImpactedDependencyDetails{
184184
SeverityDetails: formats.SeverityDetails{
185185
Severity: "Medium",
186-
SeverityNumValue: 14,
186+
SeverityNumValue: 19,
187187
},
188188
ImpactedDependencyName: "Dep-1",
189189
},

0 commit comments

Comments
 (0)