Skip to content

Commit

Permalink
add init func to download analyzer manager
Browse files Browse the repository at this point in the history
  • Loading branch information
omerzi committed Aug 16, 2023
1 parent b44f607 commit 92c0de4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions xray/audit/jas/secretsscanner_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package jas

import (
rtutils "github.com/jfrog/jfrog-cli-core/v2/artifactory/utils"
"github.com/jfrog/jfrog-cli-core/v2/utils/coreutils"
"github.com/stretchr/testify/assert"
"os"
Expand All @@ -9,7 +10,7 @@ import (
)

func TestNewSecretsScanManager(t *testing.T) {
// Act
assert.NoError(t, rtutils.DownloadAnalyzerManagerIfNeeded())
scanner, err := NewAdvancedSecurityScanner(nil, &fakeServerDetails)
assert.NoError(t, err)
defer func() {
Expand All @@ -19,7 +20,6 @@ func TestNewSecretsScanManager(t *testing.T) {
}()
secretScanManager := newSecretsScanManager(scanner)

// Assert
assert.NoError(t, err)
assert.NotEmpty(t, secretScanManager)
assert.NotEmpty(t, secretScanManager.scanner.configFileName)
Expand All @@ -28,6 +28,7 @@ func TestNewSecretsScanManager(t *testing.T) {
}

func TestSecretsScan_CreateConfigFile_VerifyFileWasCreated(t *testing.T) {
assert.NoError(t, rtutils.DownloadAnalyzerManagerIfNeeded())
scanner, err := NewAdvancedSecurityScanner(nil, &fakeServerDetails)
assert.NoError(t, err)
defer func() {
Expand Down Expand Up @@ -60,6 +61,7 @@ func TestRunAnalyzerManager_ReturnsGeneralError(t *testing.T) {
}()

// Arrange
assert.NoError(t, rtutils.DownloadAnalyzerManagerIfNeeded())
scanner, err := NewAdvancedSecurityScanner(nil, &fakeServerDetails)
assert.NoError(t, err)
defer func() {
Expand All @@ -78,6 +80,7 @@ func TestRunAnalyzerManager_ReturnsGeneralError(t *testing.T) {

func TestParseResults_EmptyResults(t *testing.T) {
// Arrange
assert.NoError(t, rtutils.DownloadAnalyzerManagerIfNeeded())
scanner, err := NewAdvancedSecurityScanner(nil, &fakeServerDetails)
assert.NoError(t, err)
defer func() {
Expand All @@ -98,6 +101,7 @@ func TestParseResults_EmptyResults(t *testing.T) {

func TestParseResults_ResultsContainSecrets(t *testing.T) {
// Arrange
assert.NoError(t, rtutils.DownloadAnalyzerManagerIfNeeded())
scanner, err := NewAdvancedSecurityScanner(nil, &fakeServerDetails)
assert.NoError(t, err)
defer func() {
Expand All @@ -119,6 +123,7 @@ func TestParseResults_ResultsContainSecrets(t *testing.T) {

func TestGetSecretsScanResults_AnalyzerManagerReturnsError(t *testing.T) {
// Act
assert.NoError(t, rtutils.DownloadAnalyzerManagerIfNeeded())
scanner, err := NewAdvancedSecurityScanner(nil, &fakeServerDetails)
assert.NoError(t, err)
defer func() {
Expand Down

0 comments on commit 92c0de4

Please sign in to comment.