blob: 8f5df7dd5dc7fe486333f4308fd55c1c27ca045b [file] [log] [blame]
Keith Byrnebda48592016-03-23 11:37:08 +00001// +build fixtures
2
Jon Perritta065da12015-02-06 10:20:16 -07003package stackresources
4
5import (
6 "fmt"
7 "net/http"
8 "testing"
9 "time"
10
11 "github.com/rackspace/gophercloud"
12 th "github.com/rackspace/gophercloud/testhelper"
13 fake "github.com/rackspace/gophercloud/testhelper/client"
14)
15
Jon Perrittbba201b2015-02-08 21:12:38 -070016// FindExpected represents the expected object from a Find request.
Jon Perritta065da12015-02-06 10:20:16 -070017var FindExpected = []Resource{
18 Resource{
19 Name: "hello_world",
20 Links: []gophercloud.Link{
21 gophercloud.Link{
22 Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b/resources/hello_world",
23 Rel: "self",
24 },
25 gophercloud.Link{
26 Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b",
27 Rel: "stack",
28 },
29 },
30 LogicalID: "hello_world",
31 StatusReason: "state changed",
32 UpdatedTime: time.Date(2015, 2, 5, 21, 33, 11, 0, time.UTC),
Pratik Mallya827c03e2015-09-17 00:10:47 -050033 CreationTime: time.Date(2015, 2, 5, 21, 33, 10, 0, time.UTC),
Jon Perritta065da12015-02-06 10:20:16 -070034 RequiredBy: []interface{}{},
35 Status: "CREATE_IN_PROGRESS",
36 PhysicalID: "49181cd6-169a-4130-9455-31185bbfc5bf",
37 Type: "OS::Nova::Server",
Pratik Mallya827c03e2015-09-17 00:10:47 -050038 Attributes: map[string]interface{}{"SXSW": "atx"},
39 Description: "Some resource",
Jon Perritta065da12015-02-06 10:20:16 -070040 },
41}
42
Jon Perrittbba201b2015-02-08 21:12:38 -070043// FindOutput represents the response body from a Find request.
Jon Perritta065da12015-02-06 10:20:16 -070044const FindOutput = `
45{
46 "resources": [
47 {
Pratik Mallya827c03e2015-09-17 00:10:47 -050048 "description": "Some resource",
49 "attributes": {"SXSW": "atx"},
Jon Perritta065da12015-02-06 10:20:16 -070050 "resource_name": "hello_world",
51 "links": [
52 {
53 "href": "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b/resources/hello_world",
54 "rel": "self"
55 },
56 {
57 "href": "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b",
58 "rel": "stack"
59 }
60 ],
61 "logical_resource_id": "hello_world",
62 "resource_status_reason": "state changed",
Pratik Mallyae1b6cbb2015-09-09 14:24:14 -050063 "updated_time": "2015-02-05T21:33:11",
Pratik Mallya827c03e2015-09-17 00:10:47 -050064 "creation_time": "2015-02-05T21:33:10",
Jon Perritta065da12015-02-06 10:20:16 -070065 "required_by": [],
66 "resource_status": "CREATE_IN_PROGRESS",
67 "physical_resource_id": "49181cd6-169a-4130-9455-31185bbfc5bf",
68 "resource_type": "OS::Nova::Server"
69 }
70 ]
71}`
72
73// HandleFindSuccessfully creates an HTTP handler at `/stacks/hello_world/resources`
74// on the test handler mux that responds with a `Find` response.
75func HandleFindSuccessfully(t *testing.T, output string) {
76 th.Mux.HandleFunc("/stacks/hello_world/resources", func(w http.ResponseWriter, r *http.Request) {
77 th.TestMethod(t, r, "GET")
78 th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
79 th.TestHeader(t, r, "Accept", "application/json")
80
81 w.Header().Set("Content-Type", "application/json")
82 w.WriteHeader(http.StatusOK)
83 fmt.Fprintf(w, output)
84 })
85}
86
Jon Perrittbba201b2015-02-08 21:12:38 -070087// ListExpected represents the expected object from a List request.
Jon Perritta065da12015-02-06 10:20:16 -070088var ListExpected = []Resource{
89 Resource{
90 Name: "hello_world",
91 Links: []gophercloud.Link{
92 gophercloud.Link{
93 Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b/resources/hello_world",
94 Rel: "self",
95 },
96 gophercloud.Link{
97 Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b",
98 Rel: "stack",
99 },
100 },
101 LogicalID: "hello_world",
102 StatusReason: "state changed",
103 UpdatedTime: time.Date(2015, 2, 5, 21, 33, 11, 0, time.UTC),
Pratik Mallya827c03e2015-09-17 00:10:47 -0500104 CreationTime: time.Date(2015, 2, 5, 21, 33, 10, 0, time.UTC),
Jon Perritta065da12015-02-06 10:20:16 -0700105 RequiredBy: []interface{}{},
106 Status: "CREATE_IN_PROGRESS",
107 PhysicalID: "49181cd6-169a-4130-9455-31185bbfc5bf",
108 Type: "OS::Nova::Server",
Pratik Mallya827c03e2015-09-17 00:10:47 -0500109 Attributes: map[string]interface{}{"SXSW": "atx"},
110 Description: "Some resource",
Jon Perritta065da12015-02-06 10:20:16 -0700111 },
112}
113
Jon Perrittbba201b2015-02-08 21:12:38 -0700114// ListOutput represents the response body from a List request.
Jon Perritta065da12015-02-06 10:20:16 -0700115const ListOutput = `{
116 "resources": [
117 {
118 "resource_name": "hello_world",
119 "links": [
120 {
121 "href": "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b/resources/hello_world",
122 "rel": "self"
123 },
124 {
125 "href": "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/5f57cff9-93fc-424e-9f78-df0515e7f48b",
126 "rel": "stack"
127 }
128 ],
129 "logical_resource_id": "hello_world",
130 "resource_status_reason": "state changed",
Pratik Mallyae1b6cbb2015-09-09 14:24:14 -0500131 "updated_time": "2015-02-05T21:33:11",
Jon Perritta065da12015-02-06 10:20:16 -0700132 "required_by": [],
133 "resource_status": "CREATE_IN_PROGRESS",
134 "physical_resource_id": "49181cd6-169a-4130-9455-31185bbfc5bf",
Pratik Mallya827c03e2015-09-17 00:10:47 -0500135 "creation_time": "2015-02-05T21:33:10",
136 "resource_type": "OS::Nova::Server",
137 "attributes": {"SXSW": "atx"},
138 "description": "Some resource"
Jon Perritta065da12015-02-06 10:20:16 -0700139 }
140]
141}`
142
143// HandleListSuccessfully creates an HTTP handler at `/stacks/hello_world/49181cd6-169a-4130-9455-31185bbfc5bf/resources`
144// on the test handler mux that responds with a `List` response.
145func HandleListSuccessfully(t *testing.T, output string) {
146 th.Mux.HandleFunc("/stacks/hello_world/49181cd6-169a-4130-9455-31185bbfc5bf/resources", func(w http.ResponseWriter, r *http.Request) {
147 th.TestMethod(t, r, "GET")
148 th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
149 th.TestHeader(t, r, "Accept", "application/json")
150
151 w.Header().Set("Content-Type", "application/json")
152 r.ParseForm()
153 marker := r.Form.Get("marker")
154 switch marker {
155 case "":
156 fmt.Fprintf(w, output)
Jon Perritt64f594d2015-02-08 21:24:33 -0700157 case "49181cd6-169a-4130-9455-31185bbfc5bf":
158 fmt.Fprintf(w, `{"resources":[]}`)
Jon Perritta065da12015-02-06 10:20:16 -0700159 default:
160 t.Fatalf("Unexpected marker: [%s]", marker)
161 }
162 })
163}
164
Jon Perrittbba201b2015-02-08 21:12:38 -0700165// GetExpected represents the expected object from a Get request.
Jon Perritta065da12015-02-06 10:20:16 -0700166var GetExpected = &Resource{
167 Name: "wordpress_instance",
168 Links: []gophercloud.Link{
169 gophercloud.Link{
170 Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/teststack/0b1771bd-9336-4f2b-ae86-a80f971faf1e/resources/wordpress_instance",
171 Rel: "self",
172 },
173 gophercloud.Link{
174 Href: "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/teststack/0b1771bd-9336-4f2b-ae86-a80f971faf1e",
175 Rel: "stack",
176 },
177 },
178 LogicalID: "wordpress_instance",
Pratik Mallya827c03e2015-09-17 00:10:47 -0500179 Attributes: map[string]interface{}{"SXSW": "atx"},
Jon Perritta065da12015-02-06 10:20:16 -0700180 StatusReason: "state changed",
181 UpdatedTime: time.Date(2014, 12, 10, 18, 34, 35, 0, time.UTC),
182 RequiredBy: []interface{}{},
183 Status: "CREATE_COMPLETE",
184 PhysicalID: "00e3a2fe-c65d-403c-9483-4db9930dd194",
185 Type: "OS::Nova::Server",
186}
187
Jon Perrittbba201b2015-02-08 21:12:38 -0700188// GetOutput represents the response body from a Get request.
Jon Perritta065da12015-02-06 10:20:16 -0700189const GetOutput = `
190{
191 "resource": {
Pratik Mallya827c03e2015-09-17 00:10:47 -0500192 "description": "Some resource",
193 "attributes": {"SXSW": "atx"},
Jon Perritta065da12015-02-06 10:20:16 -0700194 "resource_name": "wordpress_instance",
195 "description": "",
196 "links": [
197 {
198 "href": "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/teststack/0b1771bd-9336-4f2b-ae86-a80f971faf1e/resources/wordpress_instance",
199 "rel": "self"
200 },
201 {
202 "href": "http://166.78.160.107:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/teststack/0b1771bd-9336-4f2b-ae86-a80f971faf1e",
203 "rel": "stack"
204 }
205 ],
206 "logical_resource_id": "wordpress_instance",
207 "resource_status": "CREATE_COMPLETE",
Pratik Mallyae1b6cbb2015-09-09 14:24:14 -0500208 "updated_time": "2014-12-10T18:34:35",
Jon Perritta065da12015-02-06 10:20:16 -0700209 "required_by": [],
210 "resource_status_reason": "state changed",
211 "physical_resource_id": "00e3a2fe-c65d-403c-9483-4db9930dd194",
212 "resource_type": "OS::Nova::Server"
213 }
214}`
215
216// HandleGetSuccessfully creates an HTTP handler at `/stacks/teststack/0b1771bd-9336-4f2b-ae86-a80f971faf1e/resources/wordpress_instance`
217// on the test handler mux that responds with a `Get` response.
218func HandleGetSuccessfully(t *testing.T, output string) {
219 th.Mux.HandleFunc("/stacks/teststack/0b1771bd-9336-4f2b-ae86-a80f971faf1e/resources/wordpress_instance", func(w http.ResponseWriter, r *http.Request) {
220 th.TestMethod(t, r, "GET")
221 th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
222 th.TestHeader(t, r, "Accept", "application/json")
223
224 w.Header().Set("Content-Type", "application/json")
225 w.WriteHeader(http.StatusOK)
226 fmt.Fprintf(w, output)
227 })
228}
229
Jon Perrittbba201b2015-02-08 21:12:38 -0700230// MetadataExpected represents the expected object from a Metadata request.
Jon Perritta065da12015-02-06 10:20:16 -0700231var MetadataExpected = map[string]string{
232 "number": "7",
233 "animal": "auk",
234}
235
Jon Perrittbba201b2015-02-08 21:12:38 -0700236// MetadataOutput represents the response body from a Metadata request.
Jon Perritta065da12015-02-06 10:20:16 -0700237const MetadataOutput = `
238{
239 "metadata": {
240 "number": "7",
241 "animal": "auk"
242 }
243}`
244
245// HandleMetadataSuccessfully creates an HTTP handler at `/stacks/teststack/0b1771bd-9336-4f2b-ae86-a80f971faf1e/resources/wordpress_instance/metadata`
246// on the test handler mux that responds with a `Metadata` response.
247func HandleMetadataSuccessfully(t *testing.T, output string) {
248 th.Mux.HandleFunc("/stacks/teststack/0b1771bd-9336-4f2b-ae86-a80f971faf1e/resources/wordpress_instance/metadata", func(w http.ResponseWriter, r *http.Request) {
249 th.TestMethod(t, r, "GET")
250 th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
251 th.TestHeader(t, r, "Accept", "application/json")
252
253 w.Header().Set("Content-Type", "application/json")
254 w.WriteHeader(http.StatusOK)
255 fmt.Fprintf(w, output)
256 })
257}
258
Jon Perrittbba201b2015-02-08 21:12:38 -0700259// ListTypesExpected represents the expected object from a ListTypes request.
Pratik Mallya3de347f2015-09-22 12:25:59 -0500260var ListTypesExpected = ResourceTypes{
Jon Perritta065da12015-02-06 10:20:16 -0700261 "OS::Nova::Server",
262 "OS::Heat::RandomString",
263 "OS::Swift::Container",
264 "OS::Trove::Instance",
265 "OS::Nova::FloatingIPAssociation",
266 "OS::Cinder::VolumeAttachment",
267 "OS::Nova::FloatingIP",
268 "OS::Nova::KeyPair",
269}
270
Pratik Mallya827c03e2015-09-17 00:10:47 -0500271// same as above, but sorted
Pratik Mallya3de347f2015-09-22 12:25:59 -0500272var SortedListTypesExpected = ResourceTypes{
Pratik Mallya827c03e2015-09-17 00:10:47 -0500273 "OS::Cinder::VolumeAttachment",
274 "OS::Heat::RandomString",
275 "OS::Nova::FloatingIP",
276 "OS::Nova::FloatingIPAssociation",
277 "OS::Nova::KeyPair",
278 "OS::Nova::Server",
279 "OS::Swift::Container",
280 "OS::Trove::Instance",
281}
282
Jon Perrittbba201b2015-02-08 21:12:38 -0700283// ListTypesOutput represents the response body from a ListTypes request.
Jon Perritta065da12015-02-06 10:20:16 -0700284const ListTypesOutput = `
285{
286 "resource_types": [
287 "OS::Nova::Server",
288 "OS::Heat::RandomString",
289 "OS::Swift::Container",
290 "OS::Trove::Instance",
291 "OS::Nova::FloatingIPAssociation",
292 "OS::Cinder::VolumeAttachment",
293 "OS::Nova::FloatingIP",
294 "OS::Nova::KeyPair"
295 ]
296}`
297
298// HandleListTypesSuccessfully creates an HTTP handler at `/resource_types`
299// on the test handler mux that responds with a `ListTypes` response.
300func HandleListTypesSuccessfully(t *testing.T, output string) {
301 th.Mux.HandleFunc("/resource_types", func(w http.ResponseWriter, r *http.Request) {
302 th.TestMethod(t, r, "GET")
303 th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
304 th.TestHeader(t, r, "Accept", "application/json")
305
306 w.Header().Set("Content-Type", "application/json")
307 w.WriteHeader(http.StatusOK)
308 fmt.Fprintf(w, output)
309 })
310}
Jon Perritt1d4aca02015-02-06 12:29:16 -0700311
Jon Perrittbba201b2015-02-08 21:12:38 -0700312// GetSchemaExpected represents the expected object from a Schema request.
Jon Perritt1d4aca02015-02-06 12:29:16 -0700313var GetSchemaExpected = &TypeSchema{
314 Attributes: map[string]interface{}{
315 "an_attribute": map[string]interface{}{
316 "description": "An attribute description .",
317 },
318 },
319 Properties: map[string]interface{}{
320 "a_property": map[string]interface{}{
321 "update_allowed": false,
322 "required": true,
323 "type": "string",
324 "description": "A resource description.",
325 },
326 },
327 ResourceType: "OS::Heat::AResourceName",
Pratik Mallya827c03e2015-09-17 00:10:47 -0500328 SupportStatus: map[string]interface{}{
329 "message": "A status message",
330 "status": "SUPPORTED",
331 "version": "2014.1",
332 },
Jon Perritt1d4aca02015-02-06 12:29:16 -0700333}
334
Jon Perrittbba201b2015-02-08 21:12:38 -0700335// GetSchemaOutput represents the response body from a Schema request.
Jon Perritt1d4aca02015-02-06 12:29:16 -0700336const GetSchemaOutput = `
337{
338 "attributes": {
339 "an_attribute": {
340 "description": "An attribute description ."
341 }
342 },
343 "properties": {
344 "a_property": {
345 "update_allowed": false,
346 "required": true,
347 "type": "string",
348 "description": "A resource description."
349 }
350 },
Pratik Mallya827c03e2015-09-17 00:10:47 -0500351 "resource_type": "OS::Heat::AResourceName",
352 "support_status": {
353 "message": "A status message",
354 "status": "SUPPORTED",
355 "version": "2014.1"
356 }
Jon Perritt1d4aca02015-02-06 12:29:16 -0700357}`
358
359// HandleGetSchemaSuccessfully creates an HTTP handler at `/resource_types/OS::Heat::AResourceName`
360// on the test handler mux that responds with a `Schema` response.
361func HandleGetSchemaSuccessfully(t *testing.T, output string) {
362 th.Mux.HandleFunc("/resource_types/OS::Heat::AResourceName", func(w http.ResponseWriter, r *http.Request) {
363 th.TestMethod(t, r, "GET")
364 th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
365 th.TestHeader(t, r, "Accept", "application/json")
366
367 w.Header().Set("Content-Type", "application/json")
368 w.WriteHeader(http.StatusOK)
369 fmt.Fprintf(w, output)
370 })
371}
372
Jon Perrittbba201b2015-02-08 21:12:38 -0700373// GetTemplateExpected represents the expected object from a Template request.
Pratik Mallya827c03e2015-09-17 00:10:47 -0500374var GetTemplateExpected = "{\n \"HeatTemplateFormatVersion\": \"2012-12-12\",\n \"Outputs\": {\n \"private_key\": {\n \"Description\": \"The private key if it has been saved.\",\n \"Value\": \"{\\\"Fn::GetAtt\\\": [\\\"KeyPair\\\", \\\"private_key\\\"]}\"\n },\n \"public_key\": {\n \"Description\": \"The public key.\",\n \"Value\": \"{\\\"Fn::GetAtt\\\": [\\\"KeyPair\\\", \\\"public_key\\\"]}\"\n }\n },\n \"Parameters\": {\n \"name\": {\n \"Description\": \"The name of the key pair.\",\n \"Type\": \"String\"\n },\n \"public_key\": {\n \"Description\": \"The optional public key. This allows users to supply the public key from a pre-existing key pair. If not supplied, a new key pair will be generated.\",\n \"Type\": \"String\"\n },\n \"save_private_key\": {\n \"AllowedValues\": [\n \"True\",\n \"true\",\n \"False\",\n \"false\"\n ],\n \"Default\": false,\n \"Description\": \"True if the system should remember a generated private key; False otherwise.\",\n \"Type\": \"String\"\n }\n },\n \"Resources\": {\n \"KeyPair\": {\n \"Properties\": {\n \"name\": {\n \"Ref\": \"name\"\n },\n \"public_key\": {\n \"Ref\": \"public_key\"\n },\n \"save_private_key\": {\n \"Ref\": \"save_private_key\"\n }\n },\n \"Type\": \"OS::Nova::KeyPair\"\n }\n }\n}"
Jon Perrittb1e303a2015-02-06 22:15:44 -0700375
Jon Perrittbba201b2015-02-08 21:12:38 -0700376// GetTemplateOutput represents the response body from a Template request.
Jon Perritt1d4aca02015-02-06 12:29:16 -0700377const GetTemplateOutput = `
378{
Jon Perrittb1e303a2015-02-06 22:15:44 -0700379 "HeatTemplateFormatVersion": "2012-12-12",
Jon Perritt1d4aca02015-02-06 12:29:16 -0700380 "Outputs": {
Jon Perrittb1e303a2015-02-06 22:15:44 -0700381 "private_key": {
382 "Description": "The private key if it has been saved.",
383 "Value": "{\"Fn::GetAtt\": [\"KeyPair\", \"private_key\"]}"
Jon Perritt1d4aca02015-02-06 12:29:16 -0700384 },
Jon Perrittb1e303a2015-02-06 22:15:44 -0700385 "public_key": {
386 "Description": "The public key.",
387 "Value": "{\"Fn::GetAtt\": [\"KeyPair\", \"public_key\"]}"
Jon Perritt1d4aca02015-02-06 12:29:16 -0700388 }
389 },
Jon Perritt1d4aca02015-02-06 12:29:16 -0700390 "Parameters": {
Jon Perritt1d4aca02015-02-06 12:29:16 -0700391 "name": {
Jon Perrittb1e303a2015-02-06 22:15:44 -0700392 "Description": "The name of the key pair.",
393 "Type": "String"
Jon Perritt1d4aca02015-02-06 12:29:16 -0700394 },
Jon Perrittb1e303a2015-02-06 22:15:44 -0700395 "public_key": {
396 "Description": "The optional public key. This allows users to supply the public key from a pre-existing key pair. If not supplied, a new key pair will be generated.",
397 "Type": "String"
Jon Perritt1d4aca02015-02-06 12:29:16 -0700398 },
Jon Perrittb1e303a2015-02-06 22:15:44 -0700399 "save_private_key": {
Jon Perritt1d4aca02015-02-06 12:29:16 -0700400 "AllowedValues": [
Jon Perrittb1e303a2015-02-06 22:15:44 -0700401 "True",
402 "true",
403 "False",
404 "false"
405 ],
406 "Default": false,
407 "Description": "True if the system should remember a generated private key; False otherwise.",
408 "Type": "String"
Jon Perritt1d4aca02015-02-06 12:29:16 -0700409 }
410 },
411 "Resources": {
Jon Perrittb1e303a2015-02-06 22:15:44 -0700412 "KeyPair": {
Jon Perritt1d4aca02015-02-06 12:29:16 -0700413 "Properties": {
Jon Perritt1d4aca02015-02-06 12:29:16 -0700414 "name": {
415 "Ref": "name"
416 },
Jon Perrittb1e303a2015-02-06 22:15:44 -0700417 "public_key": {
418 "Ref": "public_key"
Jon Perritt1d4aca02015-02-06 12:29:16 -0700419 },
Jon Perrittb1e303a2015-02-06 22:15:44 -0700420 "save_private_key": {
421 "Ref": "save_private_key"
Jon Perritt1d4aca02015-02-06 12:29:16 -0700422 }
Jon Perrittb1e303a2015-02-06 22:15:44 -0700423 },
424 "Type": "OS::Nova::KeyPair"
Jon Perritt1d4aca02015-02-06 12:29:16 -0700425 }
426 }
427}`
Jon Perrittb1e303a2015-02-06 22:15:44 -0700428
429// HandleGetTemplateSuccessfully creates an HTTP handler at `/resource_types/OS::Heat::AResourceName/template`
430// on the test handler mux that responds with a `Template` response.
431func HandleGetTemplateSuccessfully(t *testing.T, output string) {
432 th.Mux.HandleFunc("/resource_types/OS::Heat::AResourceName/template", func(w http.ResponseWriter, r *http.Request) {
433 th.TestMethod(t, r, "GET")
434 th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
435 th.TestHeader(t, r, "Accept", "application/json")
436
437 w.Header().Set("Content-Type", "application/json")
438 w.WriteHeader(http.StatusOK)
439 fmt.Fprintf(w, output)
440 })
441}