-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validate xray url #160
base: dev
Are you sure you want to change the base?
Validate xray url #160
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -474,7 +474,7 @@ func addDummyPackageDescriptor(t *testing.T, hasPackageJson bool) { | |
// JAS | ||
|
||
func TestXrayAuditNotEntitledForJas(t *testing.T) { | ||
cliToRun, cleanUp := securityTestUtils.InitTestWithMockCommandOrParams(t, getNoJasAuditMockCommand) | ||
cliToRun, cleanUp := securityTestUtils.InitTestWithMockCommandOrParams(t, false, getNoJasAuditMockCommand) | ||
defer cleanUp() | ||
output := testXrayAuditJas(t, cliToRun, filepath.Join("jas", "jas"), "3", false) | ||
// Verify that scan results are printed | ||
|
@@ -620,3 +620,37 @@ func TestAuditOnEmptyProject(t *testing.T) { | |
output := securityTests.PlatformCli.WithoutCredentials().RunCliCmdWithOutput(t, "audit", "--format="+string(format.SimpleJson)) | ||
securityTestUtils.VerifySimpleJsonJasResults(t, output, 0, 0, 0, 0, 0, 0, 0, 0, 0) | ||
} | ||
|
||
// xray-url only | ||
|
||
func TestXrayAuditNotEntitledForJasWithXrayUrl(t *testing.T) { | ||
cliToRun, cleanUp := securityTestUtils.InitTestWithMockCommandOrParams(t, true, getNoJasAuditMockCommandWithXrayUrl) | ||
defer cleanUp() | ||
output := testXrayAuditJas(t, cliToRun, filepath.Join("jas", "jas"), "3", false) | ||
// Verify that scan results are printed | ||
securityTestUtils.VerifySimpleJsonScanResults(t, output, 0, 8, 0) | ||
// Verify that JAS results are not printed | ||
securityTestUtils.VerifySimpleJsonJasResults(t, output, 0, 0, 0, 0, 0, 0, 0, 0, 0) | ||
} | ||
|
||
func getNoJasAuditMockCommandWithXrayUrl() components.Command { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can use the function |
||
return components.Command{ | ||
Name: docs.Audit, | ||
Flags: docs.GetCommandFlags(docs.Audit), | ||
Action: func(c *components.Context) error { | ||
auditCmd, err := cli.CreateAuditCmd(c) | ||
if err != nil { | ||
return err | ||
} | ||
// Disable Jas for this test | ||
auditCmd.SetUseJas(false) | ||
return progressbar.ExecWithProgress(auditCmd) | ||
}, | ||
} | ||
} | ||
|
||
func TestXrayAuditJasSimpleJsonWithXrayUrl(t *testing.T) { | ||
output := testXrayAuditJas(t, securityTests.PlatformCli, filepath.Join("jas", "jas"), "3", false) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you should create here a 'cliToRun' object, same in |
||
securityTestUtils.VerifySimpleJsonScanResults(t, output, 0, 8, 0) | ||
securityTestUtils.VerifySimpleJsonJasResults(t, output, 1, 9, 6, 3, 1, 1, 2, 0, 0) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make the comment more informative?