Skip to content

Commit

Permalink
fix audit tests for xray-url
Browse files Browse the repository at this point in the history
  • Loading branch information
hadarshjfrog committed Oct 15, 2024
1 parent f4fab1b commit 9dfb59c
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions audit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -740,10 +740,10 @@ func TestAuditOnEmptyProject(t *testing.T) {
validations.VerifySimpleJsonResults(t, output, validations.ValidationParams{})
}

// xray-url only
// xray-url only - the following tests check the case of adding "xray-url", instead of "url", which is the more common one

func TestXrayAuditNotEntitledForJasWithXrayUrl(t *testing.T) {
cliToRun, cleanUp := securityTestUtils.InitTestWithMockCommandOrParams(t, true, getNoJasAuditMockCommandWithXrayUrl)
cliToRun, cleanUp := securityTestUtils.InitTestWithMockCommandOrParams(t, true, getNoJasAuditMockCommand)
defer cleanUp()
output := testXrayAuditJas(t, cliToRun, filepath.Join("jas", "jas"), "3", false)

Check failure on line 748 in audit_test.go

View workflow job for this annotation

GitHub Actions / Static-Check

not enough arguments in call to testXrayAuditJas

Check failure on line 748 in audit_test.go

View workflow job for this annotation

GitHub Actions / test (ubuntu)

not enough arguments in call to testXrayAuditJas

Check failure on line 748 in audit_test.go

View workflow job for this annotation

GitHub Actions / Go-Sec

not enough arguments in call to testXrayAuditJas

Check failure on line 748 in audit_test.go

View workflow job for this annotation

GitHub Actions / test (windows)

not enough arguments in call to testXrayAuditJas

Check failure on line 748 in audit_test.go

View workflow job for this annotation

GitHub Actions / test (macos)

not enough arguments in call to testXrayAuditJas
// Verify that scan results are printed
Expand All @@ -752,24 +752,10 @@ func TestXrayAuditNotEntitledForJasWithXrayUrl(t *testing.T) {
securityTestUtils.VerifySimpleJsonJasResults(t, output, 0, 0, 0, 0, 0, 0, 0, 0, 0)

Check failure on line 752 in audit_test.go

View workflow job for this annotation

GitHub Actions / Static-Check

undefined: securityTestUtils.VerifySimpleJsonJasResults

Check failure on line 752 in audit_test.go

View workflow job for this annotation

GitHub Actions / test (ubuntu)

undefined: securityTestUtils.VerifySimpleJsonJasResults

Check failure on line 752 in audit_test.go

View workflow job for this annotation

GitHub Actions / Go-Sec

undefined: securityTestUtils.VerifySimpleJsonJasResults

Check failure on line 752 in audit_test.go

View workflow job for this annotation

GitHub Actions / test (windows)

undefined: securityTestUtils.VerifySimpleJsonJasResults

Check failure on line 752 in audit_test.go

View workflow job for this annotation

GitHub Actions / test (macos)

undefined: securityTestUtils.VerifySimpleJsonJasResults
}

func getNoJasAuditMockCommandWithXrayUrl() components.Command {
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)
cliToRun, cleanUp := securityTestUtils.InitTestWithMockCommandOrParams(t, true, getNoJasAuditMockCommand)
defer cleanUp()
output := testXrayAuditJas(t, cliToRun, filepath.Join("jas", "jas"), "3", false)

Check failure on line 758 in audit_test.go

View workflow job for this annotation

GitHub Actions / Static-Check

not enough arguments in call to testXrayAuditJas

Check failure on line 758 in audit_test.go

View workflow job for this annotation

GitHub Actions / test (ubuntu)

not enough arguments in call to testXrayAuditJas

Check failure on line 758 in audit_test.go

View workflow job for this annotation

GitHub Actions / Go-Sec

not enough arguments in call to testXrayAuditJas

Check failure on line 758 in audit_test.go

View workflow job for this annotation

GitHub Actions / test (windows)

not enough arguments in call to testXrayAuditJas

Check failure on line 758 in audit_test.go

View workflow job for this annotation

GitHub Actions / test (macos)

not enough arguments in call to testXrayAuditJas
securityTestUtils.VerifySimpleJsonScanResults(t, output, 0, 8, 0)

Check failure on line 759 in audit_test.go

View workflow job for this annotation

GitHub Actions / Static-Check

undefined: securityTestUtils.VerifySimpleJsonScanResults

Check failure on line 759 in audit_test.go

View workflow job for this annotation

GitHub Actions / test (ubuntu)

undefined: securityTestUtils.VerifySimpleJsonScanResults

Check failure on line 759 in audit_test.go

View workflow job for this annotation

GitHub Actions / Go-Sec

undefined: securityTestUtils.VerifySimpleJsonScanResults

Check failure on line 759 in audit_test.go

View workflow job for this annotation

GitHub Actions / test (windows)

undefined: securityTestUtils.VerifySimpleJsonScanResults

Check failure on line 759 in audit_test.go

View workflow job for this annotation

GitHub Actions / test (macos)

undefined: securityTestUtils.VerifySimpleJsonScanResults
securityTestUtils.VerifySimpleJsonJasResults(t, output, 1, 9, 6, 3, 1, 1, 2, 0, 0)

Check failure on line 760 in audit_test.go

View workflow job for this annotation

GitHub Actions / Static-Check

undefined: securityTestUtils.VerifySimpleJsonJasResults (typecheck)

Check failure on line 760 in audit_test.go

View workflow job for this annotation

GitHub Actions / test (ubuntu)

undefined: securityTestUtils.VerifySimpleJsonJasResults

Check failure on line 760 in audit_test.go

View workflow job for this annotation

GitHub Actions / Go-Sec

undefined: securityTestUtils.VerifySimpleJsonJasResults

Check failure on line 760 in audit_test.go

View workflow job for this annotation

GitHub Actions / test (windows)

undefined: securityTestUtils.VerifySimpleJsonJasResults

Check failure on line 760 in audit_test.go

View workflow job for this annotation

GitHub Actions / test (macos)

undefined: securityTestUtils.VerifySimpleJsonJasResults
}

0 comments on commit 9dfb59c

Please sign in to comment.