Rackspace Auto Scale: Add webhooks Create()
diff --git a/rackspace/autoscale/v1/webhooks/requests_test.go b/rackspace/autoscale/v1/webhooks/requests_test.go
index c0c1258..8c17aa2 100644
--- a/rackspace/autoscale/v1/webhooks/requests_test.go
+++ b/rackspace/autoscale/v1/webhooks/requests_test.go
@@ -8,14 +8,16 @@
"github.com/rackspace/gophercloud/testhelper/client"
)
+const (
+ groupID = "10eb3219-1b12-4b34-b1e4-e10ee4f24c65"
+ policyID = "2b48d247-0282-4b9d-8775-5c4b67e8e649"
+)
+
func TestList(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
HandleWebhookListSuccessfully(t)
- groupID := "10eb3219-1b12-4b34-b1e4-e10ee4f24c65"
- policyID := "2b48d247-0282-4b9d-8775-5c4b67e8e649"
-
pages := 0
pager := List(client.ServiceClient(), groupID, policyID)
@@ -44,3 +46,28 @@
t.Errorf("Expected 1 page, saw %d", pages)
}
}
+
+func TestCreate(t *testing.T) {
+ th.SetupHTTP()
+ defer th.TeardownHTTP()
+ HandleWebhookCreateSuccessfully(t)
+
+ client := client.ServiceClient()
+ opts := CreateOpts{
+ {
+ Name: "first hook",
+ },
+ {
+ Name: "second hook",
+ Metadata: map[string]string{
+ "notes": "a note about this webhook",
+ },
+ },
+ }
+
+ webhooks, err := Create(client, groupID, policyID, opts).ExtractWebhooks()
+
+ th.AssertNoErr(t, err)
+ th.CheckDeepEquals(t, FirstWebhook, webhooks[0])
+ th.CheckDeepEquals(t, SecondWebhook, webhooks[1])
+}