Skip to content

Commit

Permalink
update test case with expected failure for unentitled field
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobbednarz committed Aug 16, 2023
1 parent f927a9d commit 0f45ad9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion internal/sdkv2provider/resource_cloudflare_bot_management.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,15 @@ func resourceCloudflareBotManagementUpdate(ctx context.Context, d *schema.Resour
return resourceCloudflareBotManagementRead(ctx, d, meta)
}

// Deletion of bot management configuration is not something we support, we will use a dumby handler for now
// Deletion of bot management configuration is not something we support, we will
// use a dummy handler for now.
func resourceCloudflareBotManagementDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
return nil
}

func resourceCloudflareBotManagementImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
d.SetId(d.Id())
d.Set(consts.ZoneIDSchemaKey, d.Id())

resourceCloudflareBotManagementRead(ctx, d, meta)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package sdkv2provider
import (
"fmt"
"os"
"regexp"
"testing"

"github.com/cloudflare/cloudflare-go"
Expand Down Expand Up @@ -57,7 +58,7 @@ func TestAccCloudflareBotManagement_Unentitled(t *testing.T) {
bmEntConfig := cloudflare.BotManagement{
EnableJS: cloudflare.BoolPtr(true),
SuppressSessionScore: cloudflare.BoolPtr(false),
AutoUpdateModel: cloudflare.BoolPtr(true),
AutoUpdateModel: cloudflare.BoolPtr(false),
}

resource.Test(t, resource.TestCase{
Expand All @@ -72,6 +73,7 @@ func TestAccCloudflareBotManagement_Unentitled(t *testing.T) {
resource.TestCheckResourceAttr(resourceID, "suppress_session_score", "false"),
resource.TestCheckResourceAttr(resourceID, "auto_update_model", "false"),
),
ExpectError: regexp.MustCompile("zone not entitled to disable"),
},
},
})
Expand Down

0 comments on commit 0f45ad9

Please sign in to comment.