-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into MC-553-Add-SCS-report-to-console
- Loading branch information
Showing
20 changed files
with
258 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"issues":[{"engineId":"sast","type":"VULNERABILITY","primaryLocation":{"filePath":"dummy-file-name","textRange":{"startLine":10,"startColumn":9,"endColumn":10}},"secondaryLocations":[{"filePath":"dummy-file-name","textRange":{"startColumn":2,"endColumn":3}}]},{"engineId":"kics","type":"VULNERABILITY","primaryLocation":{"textRange":{"startColumn":1,"endColumn":2}},"secondaryLocations":null}]} | ||
{"issues":[{"engineId":"sast","ruleId":"1","type":"VULNERABILITY","primaryLocation":{"message":"mock-query-name-1","filePath":"dummy-file-name-1","textRange":{"startLine":10,"startColumn":10,"endColumn":30}},"secondaryLocations":[{"message":"mock-query-name-1","filePath":"dummy-file-name-1","textRange":{"startLine":11,"startColumn":3,"endColumn":13}}]},{"engineId":"sast","ruleId":"2","type":"VULNERABILITY","primaryLocation":{"message":"mock-query-name-2","filePath":"dummy-file-name-2","textRange":{"startLine":10,"startColumn":10,"endColumn":30}},"secondaryLocations":[{"message":"mock-query-name-2","filePath":"dummy-file-name-2","textRange":{"startLine":11,"startColumn":3,"endColumn":13}}]},{"engineId":"sast","ruleId":"3","type":"VULNERABILITY","primaryLocation":{"message":"mock-query-name-2","filePath":"dummy-file-name-2","textRange":{"startLine":10,"startColumn":10,"endColumn":30}},"secondaryLocations":[{"message":"mock-query-name-2","filePath":"dummy-file-name-2","textRange":{"startLine":11,"startColumn":3,"endColumn":13}},{"message":"mock-query-name-2","filePath":"dummy-file-name-2","textRange":{"startLine":12,"startColumn":3,"endColumn":13}}]},{"engineId":"sast","ruleId":"4","type":"VULNERABILITY","primaryLocation":{"message":"mock-query-name-3","filePath":"dummy-file-name-3","textRange":{"startLine":10,"startColumn":10,"endColumn":30}},"secondaryLocations":[{"message":"mock-query-name-3","filePath":"dummy-file-name-3","textRange":{"startLine":11,"startColumn":3,"endColumn":13}}]},{"engineId":"sast","ruleId":"5","type":"VULNERABILITY","primaryLocation":{"message":"mock-query-name-3","filePath":"dummy-file-name-4","textRange":{"startLine":10,"startColumn":10,"endColumn":30}},"secondaryLocations":[{"message":"mock-query-name-3","filePath":"dummy-file-name-4","textRange":{"startLine":11,"startColumn":3,"endColumn":13}}]},{"engineId":"kics","type":"VULNERABILITY","primaryLocation":{"textRange":{"endColumn":1}},"secondaryLocations":null}]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ import ( | |
"github.com/checkmarx/ast-cli/internal/commands/util/printer" | ||
"github.com/checkmarx/ast-cli/internal/params" | ||
"github.com/checkmarx/ast-cli/internal/wrappers" | ||
"github.com/checkmarx/ast-cli/internal/wrappers/mock" | ||
"gotest.tools/assert" | ||
) | ||
|
||
|
@@ -252,6 +253,7 @@ func TestRunGetBFLByScanIdAndQueryIdWithFormatList(t *testing.T) { | |
} | ||
|
||
func TestRunGetResultsGeneratingPdfReportWithInvalidEmail(t *testing.T) { | ||
mock.Flags = wrappers.FeatureFlagsResponseModel{{Name: wrappers.NewScanReportEnabled, Status: false}} | ||
err := execCmdNotNilAssertion(t, | ||
"results", "show", | ||
"--report-format", "pdf", | ||
|
@@ -261,6 +263,7 @@ func TestRunGetResultsGeneratingPdfReportWithInvalidEmail(t *testing.T) { | |
} | ||
|
||
func TestRunGetResultsGeneratingPdfReportWithInvalidOptions(t *testing.T) { | ||
mock.Flags = wrappers.FeatureFlagsResponseModel{{Name: wrappers.NewScanReportEnabled, Status: false}} | ||
err := execCmdNotNilAssertion(t, | ||
"results", "show", | ||
"--report-format", "pdf", | ||
|
@@ -269,7 +272,18 @@ func TestRunGetResultsGeneratingPdfReportWithInvalidOptions(t *testing.T) { | |
assert.Equal(t, err.Error(), "report option \"invalid\" unavailable", "Wrong expected error message") | ||
} | ||
|
||
func TestRunGetResultsGeneratingPdfReportWithInvalidImprovedOptions(t *testing.T) { | ||
mock.Flags = wrappers.FeatureFlagsResponseModel{{Name: wrappers.NewScanReportEnabled, Status: false}} | ||
err := execCmdNotNilAssertion(t, | ||
"results", "show", | ||
"--report-format", "pdf", | ||
"--scan-id", "MOCK", | ||
"--report-pdf-options", "scan-information") | ||
assert.Equal(t, err.Error(), "report option \"scan-information\" unavailable", "Wrong expected error message") | ||
} | ||
|
||
func TestRunGetResultsGeneratingPdfReportWithEmailAndOptions(t *testing.T) { | ||
mock.Flags = wrappers.FeatureFlagsResponseModel{{Name: wrappers.NewScanReportEnabled, Status: false}} | ||
cmd := createASTTestCommand() | ||
err := executeTestCommand(cmd, | ||
"results", "show", | ||
|
@@ -280,7 +294,32 @@ func TestRunGetResultsGeneratingPdfReportWithEmailAndOptions(t *testing.T) { | |
assert.NilError(t, err) | ||
} | ||
|
||
func TestRunGetResultsGeneratingPdfReporWithOptions(t *testing.T) { | ||
func TestRunGetResultsGeneratingPdfReportWithOptionsImproved(t *testing.T) { | ||
mock.Flags = wrappers.FeatureFlagsResponseModel{{Name: wrappers.NewScanReportEnabled, Status: true}} | ||
cmd := createASTTestCommand() | ||
err := executeTestCommand(cmd, | ||
"results", "show", | ||
"--report-format", "pdf", | ||
"--scan-id", "MOCK", | ||
"--report-pdf-email", "[email protected],[email protected]", | ||
"--report-pdf-options", "Iac-Security,Sast,Sca,scan-information") | ||
assert.NilError(t, err) | ||
} | ||
|
||
func TestRunGetResultsGeneratingPdfReportWithInvalidOptionsImproved(t *testing.T) { | ||
mock.Flags = wrappers.FeatureFlagsResponseModel{{Name: wrappers.NewScanReportEnabled, Status: true}} | ||
cmd := createASTTestCommand() | ||
err := executeTestCommand(cmd, | ||
"results", "show", | ||
"--report-format", "pdf", | ||
"--scan-id", "MOCK", | ||
"--report-pdf-email", "[email protected],[email protected]", | ||
"--report-pdf-options", "Iac-Security,Sast,Sca,ScanSummary") | ||
assert.Error(t, err, "report option \"scansummary\" unavailable") | ||
} | ||
|
||
func TestRunGetResultsGeneratingPdfReportWithOptions(t *testing.T) { | ||
mock.Flags = wrappers.FeatureFlagsResponseModel{{Name: wrappers.NewScanReportEnabled, Status: false}} | ||
cmd := createASTTestCommand() | ||
err := executeTestCommand(cmd, | ||
"results", "show", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.