Skip to content

Commit

Permalink
Add acceptance test
Browse files Browse the repository at this point in the history
  • Loading branch information
Qantas94Heavy committed Mar 1, 2023
1 parent 081854f commit a38388a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ func getNotificationMechanisms(s *schema.Set) []cloudflare.NotificationMechanism

func setNotificationMechanisms(md []cloudflare.NotificationMechanismData) *schema.Set {
mechanisms := make([]interface{}, 0)
data := make(map[string]interface{})

for _, m := range md {
data := make(map[string]interface{})
data["name"] = m.Name
data["id"] = m.ID
mechanisms = append(mechanisms, data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestAccCloudflareNotificationPolicy_Basic(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "enabled", "true"),
resource.TestCheckResourceAttr(resourceName, "alert_type", "universal_ssl_event_type"),
resource.TestCheckResourceAttr(resourceName, consts.AccountIDSchemaKey, accountID),
),
resource.TestCheckResourceAttr(resourceName, "email_integration.#", "2"),
},
{
Config: testCheckCloudflareNotificationPolicyUpdated(rnd, updatedPolicyName, updatedPolicyDesc, accountID),
Expand All @@ -48,7 +48,7 @@ func TestAccCloudflareNotificationPolicy_Basic(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "description", updatedPolicyDesc),
resource.TestCheckResourceAttr(resourceName, "enabled", "true"),
resource.TestCheckResourceAttr(resourceName, "alert_type", "universal_ssl_event_type"),
resource.TestCheckResourceAttr(resourceName, consts.AccountIDSchemaKey, accountID),
resource.TestCheckResourceAttr(resourceName, "email_integration.#", "2"),
),
},
},
Expand All @@ -67,6 +67,10 @@ func testCheckCloudflareNotificationPolicy(name, accountID string) string {
name = ""
id = "[email protected]"
}
email_integration {
name = ""
id = "[email protected]"
}
}`, name, accountID)
}

Expand All @@ -82,6 +86,10 @@ func testCheckCloudflareNotificationPolicyUpdated(resName, policyName, policyDes
name = ""
id = "[email protected]"
}
email_integration {
name = ""
id = "[email protected]"
}
}`, resName, policyName, policyDesc, accountID)
}

Expand Down

0 comments on commit a38388a

Please sign in to comment.