Skip to content

Commit

Permalink
fix: Enhanced web dlp rule test
Browse files Browse the repository at this point in the history
  • Loading branch information
willguibr committed Dec 16, 2023
1 parent 285587d commit d77966c
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions zia/services/dlp/dlp_web_rules/dlp_web_rules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (

"github.com/hashicorp/terraform-plugin-sdk/helper/acctest"
"github.com/zscaler/zscaler-sdk-go/v2/tests"
"github.com/zscaler/zscaler-sdk-go/v2/zia/services/common"
"github.com/zscaler/zscaler-sdk-go/v2/zia/services/dlp/dlp_engines"
)

const (
Expand Down Expand Up @@ -97,6 +99,18 @@ func TestDLPWebRule(t *testing.T) {
t.Fatalf("Error creating client: %v", err)
}

dlpEngine := dlp_engines.New(client)
engineList, err := dlpEngine.GetByPredefinedEngine("EXTERNAL")
if err != nil {
t.Errorf("Error getting saml attributes: %v", err)
return
}

// Check if engineList is not nil and contains elements
if engineList == nil || len(engineList.PredefinedEngineName) == 0 {
t.Error("Expected retrieved saml attributes to be non-empty, but got empty or nil")
}

service := New(client)
rule := WebDLPRules{
Name: name,
Expand All @@ -109,9 +123,15 @@ func TestDLPWebRule(t *testing.T) {
WithoutContentInspection: false,
DLPDownloadScanEnabled: true,
Severity: "RULE_SEVERITY_HIGH",
Protocols: []string{"FTP_RULE", "HTTPS_RULE", "HTTP_RULE"},
Protocols: []string{"HTTPS_RULE", "HTTP_RULE"},
CloudApplications: []string{"WINDOWS_LIVE_HOTMAIL"},
// FileTypes: []string{"WINDOWS_META_FORMAT", "BITMAP", "JPEG", "PNG", "TIFF"},
UserRiskScoreLevels: []string{"LOW", "MEDIUM", "HIGH", "CRITICAL"},
FileTypes: []string{"ALL_OUTBOUND"},
DLPEngines: []common.IDNameExtensions{
{
ID: engineList.ID,
},
},
}

var createdResource *WebDLPRules
Expand Down

0 comments on commit d77966c

Please sign in to comment.