Skip to content

Commit

Permalink
chore: Add test for replace_insecure_js.
Browse files Browse the repository at this point in the history
  • Loading branch information
anordby committed Sep 2, 2024
1 parent 54f673a commit 8811c86
Showing 1 changed file with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,36 @@ resource "cloudflare_zone_settings_override" "%[1]s" {
}`, rnd, zoneID)
}

func TestAccCloudflareZoneSettingsOverride_ReplaceInsecureJS(t *testing.T) {
zoneID := os.Getenv("CLOUDFLARE_ZONE_ID")
rnd := generateRandomResourceName()
name := "cloudflare_zone_settings_override." + rnd

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProviderFactories: providerFactories,
Steps: []resource.TestStep{
{
Config: testAccCheckCloudflareZoneSettingsOverrideReplaceInsecureJS(rnd, zoneID),
Check: resource.ComposeTestCheckFunc(
testAccCheckCloudflareZoneSettings(name),
resource.TestCheckResourceAttr(name, "settings.0.replace_insecure_js", "on"),
),
},
},
})
}

func testAccCheckCloudflareZoneSettingsOverrideReplaceInsecureJS(rnd, zoneID string) string {
return fmt.Sprintf(`
resource "cloudflare_zone_settings_override" "%[1]s" {
zone_id = "%[2]s"
settings {
replace_insecure_js = "on"
}
}`, rnd, zoneID)
}

func TestCloudflareZoneSettingsOverrideStateUpgradeV0(t *testing.T) {
v0 := map[string]interface{}{
"settings": []interface{}{map[string]interface{}{
Expand Down

0 comments on commit 8811c86

Please sign in to comment.