Skip to content

Commit

Permalink
fixed bug in some test
Browse files Browse the repository at this point in the history
  • Loading branch information
eranturgeman committed Oct 18, 2023
1 parent 4aa8cab commit 10ae8e7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packagehandlers/packagehandlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -654,15 +654,15 @@ func TestFixNugetVulnerabilityIfExists(t *testing.T) {
VulnerabilityOrViolationRow: formats.VulnerabilityOrViolationRow{Technology: coreutils.Nuget, ImpactedDependencyDetails: formats.ImpactedDependencyDetails{ImpactedDependencyName: "Microsoft.Bcl.AsyncInterfaces", ImpactedDependencyVersion: "8.0.0-rc.1.23419.4"}}},
},
}
currDir, err := os.Getwd()
testRootDir, err := os.Getwd()
assert.NoError(t, err)

tmpDir, err := os.MkdirTemp("", "")
assert.NoError(t, err)
assert.NoError(t, biutils.CopyDir(filepath.Join("..", "testdata", "projects", "dotnet"), tmpDir, true, nil))
assert.NoError(t, os.Chdir(tmpDir))
defer func() {
assert.NoError(t, os.Chdir(currDir))
assert.NoError(t, os.Chdir(testRootDir))
}()

assetFiles, err := getAssetsFilesPaths()
Expand All @@ -675,7 +675,11 @@ func TestFixNugetVulnerabilityIfExists(t *testing.T) {
vulnRegexpCompiler := getVulnerabilityRegexCompiler(testcase.vulnerabilityDetails.ImpactedDependencyName, testcase.vulnerabilityDetails.ImpactedDependencyVersion)

var isFileChanged bool
isFileChanged, err = fixNugetVulnerabilityIfExists(nph, testcase.vulnerabilityDetails, testedAssetFile, vulnRegexpCompiler, currDir)
wd1, _ := os.Getwd()
fmt.Println(wd1)
isFileChanged, err = fixNugetVulnerabilityIfExists(nph, testcase.vulnerabilityDetails, testedAssetFile, vulnRegexpCompiler, tmpDir)
wd2, _ := os.Getwd()
fmt.Println(wd2)
assert.NoError(t, err)
assert.True(t, isFileChanged)
}
Expand Down

0 comments on commit 10ae8e7

Please sign in to comment.