Skip to content

Commit fd79b38

Browse files
- Fixed unit tests
1 parent 5ca3c54 commit fd79b38

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

internal/services/asca_test.go

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,13 @@ func TestCreateASCAScanRequest_DefaultAgent_Success(t *testing.T) {
4949
FilePath: "data/python-vul-file.py",
5050
ASCAUpdateVersion: false,
5151
IsDefaultAgent: true,
52+
VorpalLocation: "",
5253
}
5354
wrapperParams := AscaWrappersParam{
5455
JwtWrapper: &mock.JWTMockWrapper{},
5556
ASCAWrapper: mock.NewASCAMockWrapper(1234),
5657
}
57-
sr, err := CreateASCAScanRequest(ASCAParams, wrapperParams, "")
58+
sr, err := CreateASCAScanRequest(ASCAParams, wrapperParams)
5859
if err != nil {
5960
t.Fatalf("Failed to create asca scan request: %v", err)
6061
}
@@ -74,7 +75,7 @@ func TestCreateASCAScanRequest_DefaultAgentAndLatestVersionFlag_Success(t *testi
7475
JwtWrapper: &mock.JWTMockWrapper{},
7576
ASCAWrapper: mock.NewASCAMockWrapper(1234),
7677
}
77-
sr, err := CreateASCAScanRequest(ASCAParams, wrapperParams, "")
78+
sr, err := CreateASCAScanRequest(ASCAParams, wrapperParams)
7879
if err != nil {
7980
t.Fatalf("Failed to create asca scan request: %v", err)
8081
}
@@ -222,7 +223,7 @@ func TestCreateASCAScanRequest_WithSingleIgnoredFinding_FiltersResult(t *testing
222223
ASCAWrapper: mock.NewASCAMockWrapper(1234),
223224
}
224225

225-
sr, err := CreateASCAScanRequest(ASCAParams, wrapperParams, "")
226+
sr, err := CreateASCAScanRequest(ASCAParams, wrapperParams)
226227
if err != nil {
227228
t.Fatalf("Failed to create ASCA scan request: %v", err)
228229
}
@@ -240,11 +241,11 @@ func TestCreateASCAScanRequest_WithSingleIgnoredFinding_FiltersResult(t *testing
240241

241242
func TestCreateASCAScanRequest_InvalidCustomVorpalLocation(t *testing.T) {
242243
ascaParams := AscaScanParams{
243-
FilePath: "valid/path",
244+
FilePath: "valid/path",
245+
VorpalLocation: "definitely/invalid/path",
244246
}
245247
wrapperParams := AscaWrappersParam{}
246-
invalidPath := "/definitely/invalid/path"
247-
result, err := CreateASCAScanRequest(ascaParams, wrapperParams, invalidPath)
248+
result, err := CreateASCAScanRequest(ascaParams, wrapperParams)
248249
if err == nil {
249250
t.Fatalf("Expected error for invalid vorpalLocation")
250251
}
@@ -257,10 +258,11 @@ func TestCreateASCAScanRequest_InvalidCustomVorpalLocation(t *testing.T) {
257258
func TestCreateASCAScanRequest_ValidCustomVorpalLocation_NoVorpalExe_Installed_Failed(t *testing.T) {
258259
tempDir := t.TempDir()
259260
ascaParams := AscaScanParams{
260-
FilePath: "valid/path",
261+
FilePath: "valid/path",
262+
VorpalLocation: tempDir,
261263
}
262264
wrapperParams := AscaWrappersParam{}
263-
result, err := CreateASCAScanRequest(ascaParams, wrapperParams, tempDir)
265+
result, err := CreateASCAScanRequest(ascaParams, wrapperParams)
264266
assert.NotNil(t, err)
265267

266268
_ = result
@@ -280,12 +282,13 @@ func TestCreateASCAScanRequest_ValidCustomVorpalLocation_VorPal_exe_Success(t *t
280282
ASCAUpdateVersion: false,
281283
IsDefaultAgent: true,
282284
IgnoredFilePath: "data/ignoredAsca.json",
285+
VorpalLocation: tempDir,
283286
}
284287
wrapperParams := AscaWrappersParam{
285288
JwtWrapper: &mock.JWTMockWrapper{},
286289
ASCAWrapper: mock.NewASCAMockWrapper(1234),
287290
}
288-
result, err := CreateASCAScanRequest(ASCAParams, wrapperParams, tempDir)
291+
result, err := CreateASCAScanRequest(ASCAParams, wrapperParams)
289292

290293
if err != nil {
291294
t.Fatalf("Expected no error, got: %v", err)

0 commit comments

Comments
 (0)