@@ -98,6 +98,25 @@ const PolicyCreateRequest = `
9898]
9999`
100100
101+ // PolicyGetBody contains the canned body of a policies.Get response.
102+ const PolicyGetBody = `
103+ {
104+ "policy": {
105+ "name": "webhook policy",
106+ "links": [
107+ {
108+ "href": "https://dfw.autoscale.api.rackspacecloud.com/v1.0/123456/groups/60b15dad-5ea1-43fa-9a12-a1d737b4da07/policies/2b48d247-0282-4b9d-8775-5c4b67e8e649/",
109+ "rel": "self"
110+ }
111+ ],
112+ "changePercent": 3.3,
113+ "cooldown": 300,
114+ "type": "webhook",
115+ "id": "2b48d247-0282-4b9d-8775-5c4b67e8e649"
116+ }
117+ }
118+ `
119+
101120var (
102121 // WebhookPolicy is a Policy corresponding to the first result in PolicyListBody.
103122 WebhookPolicy = Policy {
@@ -133,7 +152,7 @@ var (
133152
134153// HandlePolicyListSuccessfully sets up the test server to respond to a policies List request.
135154func HandlePolicyListSuccessfully (t * testing.T ) {
136- path := "/groups/10eb3219-1b12-4b34-b1e4-e10ee4f24c65 /policies"
155+ path := "/groups/60b15dad-5ea1-43fa-9a12-a1d737b4da07 /policies"
137156
138157 th .Mux .HandleFunc (path , func (w http.ResponseWriter , r * http.Request ) {
139158 th .TestMethod (t , r , "GET" )
@@ -147,7 +166,7 @@ func HandlePolicyListSuccessfully(t *testing.T) {
147166
148167// HandlePolicyCreateSuccessfully sets up the test server to respond to a policies Create request.
149168func HandlePolicyCreateSuccessfully (t * testing.T ) {
150- path := "/groups/10eb3219-1b12-4b34-b1e4-e10ee4f24c65 /policies"
169+ path := "/groups/60b15dad-5ea1-43fa-9a12-a1d737b4da07 /policies"
151170
152171 th .Mux .HandleFunc (path , func (w http.ResponseWriter , r * http.Request ) {
153172 th .TestMethod (t , r , "POST" )
@@ -163,3 +182,20 @@ func HandlePolicyCreateSuccessfully(t *testing.T) {
163182 fmt .Fprintf (w , PolicyCreateBody )
164183 })
165184}
185+
186+ // HandlePolicyGetSuccessfully sets up the test server to respond to a policies Get request.
187+ func HandlePolicyGetSuccessfully (t * testing.T ) {
188+ groupID := "60b15dad-5ea1-43fa-9a12-a1d737b4da07"
189+ policyID := "2b48d247-0282-4b9d-8775-5c4b67e8e649"
190+
191+ path := fmt .Sprintf ("/groups/%s/policies/%s" , groupID , policyID )
192+
193+ th .Mux .HandleFunc (path , func (w http.ResponseWriter , r * http.Request ) {
194+ th .TestMethod (t , r , "GET" )
195+ th .TestHeader (t , r , "X-Auth-Token" , client .TokenID )
196+
197+ w .Header ().Add ("Content-Type" , "application/json" )
198+
199+ fmt .Fprintf (w , PolicyGetBody )
200+ })
201+ }
0 commit comments