Jon Perritt | 4a5c849 | 2015-02-03 13:13:59 -0700 | [diff] [blame] | 1 | package stacks |
| 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | "net/http" |
| 6 | "testing" |
Jon Perritt | 9cd3d38 | 2015-02-04 15:49:41 -0700 | [diff] [blame] | 7 | "time" |
Jon Perritt | 4a5c849 | 2015-02-03 13:13:59 -0700 | [diff] [blame] | 8 | |
| 9 | "github.com/rackspace/gophercloud" |
| 10 | th "github.com/rackspace/gophercloud/testhelper" |
| 11 | fake "github.com/rackspace/gophercloud/testhelper/client" |
| 12 | ) |
| 13 | |
| 14 | // CreateExpected represents the expected object from a Create request. |
| 15 | var CreateExpected = &CreatedStack{ |
| 16 | ID: "16ef0584-4458-41eb-87c8-0dc8d5f66c87", |
| 17 | Links: []gophercloud.Link{ |
| 18 | gophercloud.Link{ |
| 19 | Href: "http://168.28.170.117:8004/v1/98606384f58drad0bhdb7d02779549ac/stacks/stackcreated/16ef0584-4458-41eb-87c8-0dc8d5f66c87", |
| 20 | Rel: "self", |
| 21 | }, |
| 22 | }, |
| 23 | } |
| 24 | |
| 25 | // CreateOutput represents the response body from a Create request. |
| 26 | const CreateOutput = ` |
| 27 | { |
| 28 | "stack": { |
| 29 | "id": "16ef0584-4458-41eb-87c8-0dc8d5f66c87", |
| 30 | "links": [ |
| 31 | { |
| 32 | "href": "http://168.28.170.117:8004/v1/98606384f58drad0bhdb7d02779549ac/stacks/stackcreated/16ef0584-4458-41eb-87c8-0dc8d5f66c87", |
| 33 | "rel": "self" |
| 34 | } |
| 35 | ] |
| 36 | } |
| 37 | }` |
| 38 | |
| 39 | // HandleCreateSuccessfully creates an HTTP handler at `/stacks` on the test handler mux |
| 40 | // that responds with a `Create` response. |
| 41 | func HandleCreateSuccessfully(t *testing.T, output string) { |
| 42 | th.Mux.HandleFunc("/stacks", func(w http.ResponseWriter, r *http.Request) { |
| 43 | th.TestMethod(t, r, "POST") |
| 44 | th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) |
| 45 | th.TestHeader(t, r, "Accept", "application/json") |
| 46 | w.WriteHeader(http.StatusCreated) |
| 47 | fmt.Fprintf(w, output) |
| 48 | }) |
| 49 | } |
Jon Perritt | 9cd3d38 | 2015-02-04 15:49:41 -0700 | [diff] [blame] | 50 | |
| 51 | // ListExpected represents the expected object from a List request. |
| 52 | var ListExpected = []ListedStack{ |
| 53 | ListedStack{ |
| 54 | Description: "Simple template to test heat commands", |
| 55 | Links: []gophercloud.Link{ |
| 56 | gophercloud.Link{ |
| 57 | Href: "http://166.76.160.117:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87", |
| 58 | Rel: "self", |
| 59 | }, |
| 60 | }, |
| 61 | StatusReason: "Stack CREATE completed successfully", |
| 62 | Name: "postman_stack", |
| 63 | CreationTime: time.Date(2015, 2, 3, 20, 7, 39, 0, time.UTC), |
| 64 | Status: "CREATE_COMPLETE", |
| 65 | ID: "16ef0584-4458-41eb-87c8-0dc8d5f66c87", |
Pratik Mallya | 827c03e | 2015-09-17 00:10:47 -0500 | [diff] [blame^] | 66 | Tags: []string{"rackspace", "atx"}, |
Jon Perritt | 9cd3d38 | 2015-02-04 15:49:41 -0700 | [diff] [blame] | 67 | }, |
| 68 | ListedStack{ |
| 69 | Description: "Simple template to test heat commands", |
| 70 | Links: []gophercloud.Link{ |
| 71 | gophercloud.Link{ |
| 72 | Href: "http://166.76.160.117:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/gophercloud-test-stack-2/db6977b2-27aa-4775-9ae7-6213212d4ada", |
| 73 | Rel: "self", |
| 74 | }, |
| 75 | }, |
| 76 | StatusReason: "Stack successfully updated", |
| 77 | Name: "gophercloud-test-stack-2", |
| 78 | CreationTime: time.Date(2014, 12, 11, 17, 39, 16, 0, time.UTC), |
| 79 | UpdatedTime: time.Date(2014, 12, 11, 17, 40, 37, 0, time.UTC), |
| 80 | Status: "UPDATE_COMPLETE", |
| 81 | ID: "db6977b2-27aa-4775-9ae7-6213212d4ada", |
Pratik Mallya | 827c03e | 2015-09-17 00:10:47 -0500 | [diff] [blame^] | 82 | Tags: []string{"sfo", "satx"}, |
Jon Perritt | 9cd3d38 | 2015-02-04 15:49:41 -0700 | [diff] [blame] | 83 | }, |
| 84 | } |
| 85 | |
| 86 | // FullListOutput represents the response body from a List request without a marker. |
| 87 | const FullListOutput = ` |
| 88 | { |
| 89 | "stacks": [ |
| 90 | { |
| 91 | "description": "Simple template to test heat commands", |
| 92 | "links": [ |
| 93 | { |
| 94 | "href": "http://166.76.160.117:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87", |
| 95 | "rel": "self" |
| 96 | } |
| 97 | ], |
| 98 | "stack_status_reason": "Stack CREATE completed successfully", |
| 99 | "stack_name": "postman_stack", |
Pratik Mallya | e1b6cbb | 2015-09-09 14:24:14 -0500 | [diff] [blame] | 100 | "creation_time": "2015-02-03T20:07:39", |
Jon Perritt | 9cd3d38 | 2015-02-04 15:49:41 -0700 | [diff] [blame] | 101 | "updated_time": null, |
| 102 | "stack_status": "CREATE_COMPLETE", |
Pratik Mallya | 827c03e | 2015-09-17 00:10:47 -0500 | [diff] [blame^] | 103 | "id": "16ef0584-4458-41eb-87c8-0dc8d5f66c87", |
| 104 | "tags": ["rackspace", "atx"] |
Jon Perritt | 9cd3d38 | 2015-02-04 15:49:41 -0700 | [diff] [blame] | 105 | }, |
| 106 | { |
| 107 | "description": "Simple template to test heat commands", |
| 108 | "links": [ |
| 109 | { |
| 110 | "href": "http://166.76.160.117:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/gophercloud-test-stack-2/db6977b2-27aa-4775-9ae7-6213212d4ada", |
| 111 | "rel": "self" |
| 112 | } |
| 113 | ], |
| 114 | "stack_status_reason": "Stack successfully updated", |
| 115 | "stack_name": "gophercloud-test-stack-2", |
Pratik Mallya | e1b6cbb | 2015-09-09 14:24:14 -0500 | [diff] [blame] | 116 | "creation_time": "2014-12-11T17:39:16", |
| 117 | "updated_time": "2014-12-11T17:40:37", |
Jon Perritt | 9cd3d38 | 2015-02-04 15:49:41 -0700 | [diff] [blame] | 118 | "stack_status": "UPDATE_COMPLETE", |
Pratik Mallya | 827c03e | 2015-09-17 00:10:47 -0500 | [diff] [blame^] | 119 | "id": "db6977b2-27aa-4775-9ae7-6213212d4ada", |
| 120 | "tags": ["sfo", "satx"] |
Jon Perritt | 9cd3d38 | 2015-02-04 15:49:41 -0700 | [diff] [blame] | 121 | } |
| 122 | ] |
| 123 | } |
| 124 | ` |
| 125 | |
| 126 | // HandleListSuccessfully creates an HTTP handler at `/stacks` on the test handler mux |
| 127 | // that responds with a `List` response. |
| 128 | func HandleListSuccessfully(t *testing.T, output string) { |
| 129 | th.Mux.HandleFunc("/stacks", func(w http.ResponseWriter, r *http.Request) { |
| 130 | th.TestMethod(t, r, "GET") |
| 131 | th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) |
| 132 | th.TestHeader(t, r, "Accept", "application/json") |
| 133 | |
| 134 | w.Header().Set("Content-Type", "application/json") |
| 135 | r.ParseForm() |
| 136 | marker := r.Form.Get("marker") |
| 137 | switch marker { |
| 138 | case "": |
| 139 | fmt.Fprintf(w, output) |
| 140 | case "db6977b2-27aa-4775-9ae7-6213212d4ada": |
| 141 | fmt.Fprintf(w, `[]`) |
| 142 | default: |
| 143 | t.Fatalf("Unexpected marker: [%s]", marker) |
| 144 | } |
| 145 | }) |
| 146 | } |
Jon Perritt | 7726e49 | 2015-02-04 17:54:28 -0700 | [diff] [blame] | 147 | |
| 148 | // GetExpected represents the expected object from a Get request. |
| 149 | var GetExpected = &RetrievedStack{ |
| 150 | DisableRollback: true, |
| 151 | Description: "Simple template to test heat commands", |
| 152 | Parameters: map[string]string{ |
| 153 | "flavor": "m1.tiny", |
| 154 | "OS::stack_name": "postman_stack", |
| 155 | "OS::stack_id": "16ef0584-4458-41eb-87c8-0dc8d5f66c87", |
| 156 | }, |
| 157 | StatusReason: "Stack CREATE completed successfully", |
| 158 | Name: "postman_stack", |
| 159 | Outputs: []map[string]interface{}{}, |
| 160 | CreationTime: time.Date(2015, 2, 3, 20, 7, 39, 0, time.UTC), |
| 161 | Links: []gophercloud.Link{ |
| 162 | gophercloud.Link{ |
| 163 | Href: "http://166.76.160.117:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87", |
| 164 | Rel: "self", |
| 165 | }, |
| 166 | }, |
| 167 | Capabilities: []interface{}{}, |
| 168 | NotificationTopics: []interface{}{}, |
| 169 | Status: "CREATE_COMPLETE", |
| 170 | ID: "16ef0584-4458-41eb-87c8-0dc8d5f66c87", |
| 171 | TemplateDescription: "Simple template to test heat commands", |
Pratik Mallya | 827c03e | 2015-09-17 00:10:47 -0500 | [diff] [blame^] | 172 | Tags: []string{"rackspace", "atx"}, |
Jon Perritt | 7726e49 | 2015-02-04 17:54:28 -0700 | [diff] [blame] | 173 | } |
| 174 | |
| 175 | // GetOutput represents the response body from a Get request. |
| 176 | const GetOutput = ` |
| 177 | { |
| 178 | "stack": { |
| 179 | "disable_rollback": true, |
| 180 | "description": "Simple template to test heat commands", |
| 181 | "parameters": { |
| 182 | "flavor": "m1.tiny", |
| 183 | "OS::stack_name": "postman_stack", |
| 184 | "OS::stack_id": "16ef0584-4458-41eb-87c8-0dc8d5f66c87" |
| 185 | }, |
| 186 | "stack_status_reason": "Stack CREATE completed successfully", |
| 187 | "stack_name": "postman_stack", |
| 188 | "outputs": [], |
Pratik Mallya | e1b6cbb | 2015-09-09 14:24:14 -0500 | [diff] [blame] | 189 | "creation_time": "2015-02-03T20:07:39", |
Jon Perritt | 7726e49 | 2015-02-04 17:54:28 -0700 | [diff] [blame] | 190 | "links": [ |
| 191 | { |
| 192 | "href": "http://166.76.160.117:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87", |
| 193 | "rel": "self" |
| 194 | } |
| 195 | ], |
| 196 | "capabilities": [], |
| 197 | "notification_topics": [], |
| 198 | "timeout_mins": null, |
| 199 | "stack_status": "CREATE_COMPLETE", |
| 200 | "updated_time": null, |
| 201 | "id": "16ef0584-4458-41eb-87c8-0dc8d5f66c87", |
Pratik Mallya | 827c03e | 2015-09-17 00:10:47 -0500 | [diff] [blame^] | 202 | "template_description": "Simple template to test heat commands", |
| 203 | "tags": ["rackspace", "atx"] |
Jon Perritt | 7726e49 | 2015-02-04 17:54:28 -0700 | [diff] [blame] | 204 | } |
| 205 | } |
| 206 | ` |
| 207 | |
| 208 | // HandleGetSuccessfully creates an HTTP handler at `/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87` |
| 209 | // on the test handler mux that responds with a `Get` response. |
| 210 | func HandleGetSuccessfully(t *testing.T, output string) { |
| 211 | th.Mux.HandleFunc("/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87", func(w http.ResponseWriter, r *http.Request) { |
| 212 | th.TestMethod(t, r, "GET") |
| 213 | th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) |
| 214 | th.TestHeader(t, r, "Accept", "application/json") |
| 215 | |
| 216 | w.Header().Set("Content-Type", "application/json") |
| 217 | w.WriteHeader(http.StatusOK) |
| 218 | fmt.Fprintf(w, output) |
| 219 | }) |
| 220 | } |
| 221 | |
| 222 | // HandleUpdateSuccessfully creates an HTTP handler at `/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87` |
| 223 | // on the test handler mux that responds with an `Update` response. |
| 224 | func HandleUpdateSuccessfully(t *testing.T) { |
| 225 | th.Mux.HandleFunc("/stacks/gophercloud-test-stack-2/db6977b2-27aa-4775-9ae7-6213212d4ada", func(w http.ResponseWriter, r *http.Request) { |
| 226 | th.TestMethod(t, r, "PUT") |
| 227 | th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) |
| 228 | th.TestHeader(t, r, "Accept", "application/json") |
| 229 | |
| 230 | w.Header().Set("Content-Type", "application/json") |
| 231 | w.WriteHeader(http.StatusAccepted) |
| 232 | }) |
| 233 | } |
Jon Perritt | a433dd9 | 2015-02-04 18:04:13 -0700 | [diff] [blame] | 234 | |
| 235 | // HandleDeleteSuccessfully creates an HTTP handler at `/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87` |
Jon Perritt | 9209df4 | 2015-02-05 12:55:33 -0700 | [diff] [blame] | 236 | // on the test handler mux that responds with a `Delete` response. |
Jon Perritt | a433dd9 | 2015-02-04 18:04:13 -0700 | [diff] [blame] | 237 | func HandleDeleteSuccessfully(t *testing.T) { |
| 238 | th.Mux.HandleFunc("/stacks/gophercloud-test-stack-2/db6977b2-27aa-4775-9ae7-6213212d4ada", func(w http.ResponseWriter, r *http.Request) { |
| 239 | th.TestMethod(t, r, "DELETE") |
| 240 | th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) |
| 241 | th.TestHeader(t, r, "Accept", "application/json") |
| 242 | |
| 243 | w.Header().Set("Content-Type", "application/json") |
| 244 | w.WriteHeader(http.StatusNoContent) |
| 245 | }) |
| 246 | } |
Jon Perritt | 37f9774 | 2015-02-04 18:55:05 -0700 | [diff] [blame] | 247 | |
| 248 | // GetExpected represents the expected object from a Get request. |
| 249 | var PreviewExpected = &PreviewedStack{ |
| 250 | DisableRollback: true, |
| 251 | Description: "Simple template to test heat commands", |
| 252 | Parameters: map[string]string{ |
| 253 | "flavor": "m1.tiny", |
| 254 | "OS::stack_name": "postman_stack", |
| 255 | "OS::stack_id": "16ef0584-4458-41eb-87c8-0dc8d5f66c87", |
| 256 | }, |
Jon Perritt | 37f9774 | 2015-02-04 18:55:05 -0700 | [diff] [blame] | 257 | Name: "postman_stack", |
| 258 | CreationTime: time.Date(2015, 2, 3, 20, 7, 39, 0, time.UTC), |
| 259 | Links: []gophercloud.Link{ |
| 260 | gophercloud.Link{ |
| 261 | Href: "http://166.76.160.117:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87", |
| 262 | Rel: "self", |
| 263 | }, |
| 264 | }, |
| 265 | Capabilities: []interface{}{}, |
| 266 | NotificationTopics: []interface{}{}, |
Jon Perritt | 37f9774 | 2015-02-04 18:55:05 -0700 | [diff] [blame] | 267 | ID: "16ef0584-4458-41eb-87c8-0dc8d5f66c87", |
| 268 | TemplateDescription: "Simple template to test heat commands", |
| 269 | } |
| 270 | |
| 271 | // HandlePreviewSuccessfully creates an HTTP handler at `/stacks/preview` |
Jon Perritt | 9209df4 | 2015-02-05 12:55:33 -0700 | [diff] [blame] | 272 | // on the test handler mux that responds with a `Preview` response. |
Jon Perritt | 37f9774 | 2015-02-04 18:55:05 -0700 | [diff] [blame] | 273 | func HandlePreviewSuccessfully(t *testing.T, output string) { |
| 274 | th.Mux.HandleFunc("/stacks/preview", func(w http.ResponseWriter, r *http.Request) { |
| 275 | th.TestMethod(t, r, "POST") |
| 276 | th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) |
| 277 | th.TestHeader(t, r, "Accept", "application/json") |
| 278 | |
| 279 | w.Header().Set("Content-Type", "application/json") |
| 280 | w.WriteHeader(http.StatusOK) |
| 281 | fmt.Fprintf(w, output) |
| 282 | }) |
| 283 | } |
Jon Perritt | 9209df4 | 2015-02-05 12:55:33 -0700 | [diff] [blame] | 284 | |
| 285 | // AbandonExpected represents the expected object from an Abandon request. |
| 286 | var AbandonExpected = &AbandonedStack{ |
| 287 | Status: "COMPLETE", |
| 288 | Name: "postman_stack", |
Jon Perritt | 6ec27cf | 2015-02-09 12:51:41 -0700 | [diff] [blame] | 289 | Template: map[string]interface{}{ |
| 290 | "heat_template_version": "2013-05-23", |
| 291 | "description": "Simple template to test heat commands", |
| 292 | "parameters": map[string]interface{}{ |
| 293 | "flavor": map[string]interface{}{ |
| 294 | "default": "m1.tiny", |
| 295 | "type": "string", |
| 296 | }, |
| 297 | }, |
| 298 | "resources": map[string]interface{}{ |
| 299 | "hello_world": map[string]interface{}{ |
| 300 | "type": "OS::Nova::Server", |
| 301 | "properties": map[string]interface{}{ |
| 302 | "key_name": "heat_key", |
| 303 | "flavor": map[string]interface{}{ |
| 304 | "get_param": "flavor", |
| 305 | }, |
| 306 | "image": "ad091b52-742f-469e-8f3c-fd81cadf0743", |
| 307 | "user_data": "#!/bin/bash -xv\necho \"hello world\" > /root/hello-world.txt\n", |
| 308 | }, |
| 309 | }, |
| 310 | }, |
| 311 | }, |
Jon Perritt | 9209df4 | 2015-02-05 12:55:33 -0700 | [diff] [blame] | 312 | Action: "CREATE", |
| 313 | ID: "16ef0584-4458-41eb-87c8-0dc8d5f66c87", |
| 314 | Resources: map[string]interface{}{ |
| 315 | "hello_world": map[string]interface{}{ |
| 316 | "status": "COMPLETE", |
| 317 | "name": "hello_world", |
| 318 | "resource_id": "8a310d36-46fc-436f-8be4-37a696b8ac63", |
| 319 | "action": "CREATE", |
| 320 | "type": "OS::Nova::Server", |
| 321 | }, |
| 322 | }, |
Pratik Mallya | 827c03e | 2015-09-17 00:10:47 -0500 | [diff] [blame^] | 323 | Files: map[string]string{ |
| 324 | "file:///Users/prat8228/go/src/github.com/rackspace/rack/my_nova.yaml": "heat_template_version: 2014-10-16\nparameters:\n flavor:\n type: string\n description: Flavor for the server to be created\n default: 4353\n hidden: true\nresources:\n test_server:\n type: \"OS::Nova::Server\"\n properties:\n name: test-server\n flavor: 2 GB General Purpose v1\n image: Debian 7 (Wheezy) (PVHVM)\n", |
| 325 | }, |
| 326 | StackUserProjectID: "897686", |
| 327 | ProjectID: "897686", |
| 328 | Environment: map[string]interface{}{ |
| 329 | "encrypted_param_names": make([]map[string]interface{}, 0), |
| 330 | "parameter_defaults": make(map[string]interface{}), |
| 331 | "parameters": make(map[string]interface{}), |
| 332 | "resource_registry": map[string]interface{}{ |
| 333 | "file:///Users/prat8228/go/src/github.com/rackspace/rack/my_nova.yaml": "file:///Users/prat8228/go/src/github.com/rackspace/rack/my_nova.yaml", |
| 334 | "resources": make(map[string]interface{}), |
| 335 | }, |
| 336 | }, |
Jon Perritt | 9209df4 | 2015-02-05 12:55:33 -0700 | [diff] [blame] | 337 | } |
| 338 | |
| 339 | // AbandonOutput represents the response body from an Abandon request. |
| 340 | const AbandonOutput = ` |
| 341 | { |
| 342 | "status": "COMPLETE", |
| 343 | "name": "postman_stack", |
| 344 | "template": { |
| 345 | "heat_template_version": "2013-05-23", |
| 346 | "description": "Simple template to test heat commands", |
| 347 | "parameters": { |
| 348 | "flavor": { |
| 349 | "default": "m1.tiny", |
| 350 | "type": "string" |
| 351 | } |
| 352 | }, |
| 353 | "resources": { |
| 354 | "hello_world": { |
| 355 | "type": "OS::Nova::Server", |
| 356 | "properties": { |
| 357 | "key_name": "heat_key", |
| 358 | "flavor": { |
| 359 | "get_param": "flavor" |
| 360 | }, |
| 361 | "image": "ad091b52-742f-469e-8f3c-fd81cadf0743", |
| 362 | "user_data": "#!/bin/bash -xv\necho \"hello world\" > /root/hello-world.txt\n" |
| 363 | } |
| 364 | } |
| 365 | } |
| 366 | }, |
| 367 | "action": "CREATE", |
| 368 | "id": "16ef0584-4458-41eb-87c8-0dc8d5f66c87", |
| 369 | "resources": { |
| 370 | "hello_world": { |
| 371 | "status": "COMPLETE", |
| 372 | "name": "hello_world", |
| 373 | "resource_id": "8a310d36-46fc-436f-8be4-37a696b8ac63", |
| 374 | "action": "CREATE", |
Pratik Mallya | 827c03e | 2015-09-17 00:10:47 -0500 | [diff] [blame^] | 375 | "type": "OS::Nova::Server" |
Jon Perritt | 9209df4 | 2015-02-05 12:55:33 -0700 | [diff] [blame] | 376 | } |
Pratik Mallya | 827c03e | 2015-09-17 00:10:47 -0500 | [diff] [blame^] | 377 | }, |
| 378 | "files": { |
| 379 | "file:///Users/prat8228/go/src/github.com/rackspace/rack/my_nova.yaml": "heat_template_version: 2014-10-16\nparameters:\n flavor:\n type: string\n description: Flavor for the server to be created\n default: 4353\n hidden: true\nresources:\n test_server:\n type: \"OS::Nova::Server\"\n properties:\n name: test-server\n flavor: 2 GB General Purpose v1\n image: Debian 7 (Wheezy) (PVHVM)\n" |
| 380 | }, |
| 381 | "environment": { |
| 382 | "encrypted_param_names": [], |
| 383 | "parameter_defaults": {}, |
| 384 | "parameters": {}, |
| 385 | "resource_registry": { |
| 386 | "file:///Users/prat8228/go/src/github.com/rackspace/rack/my_nova.yaml": "file:///Users/prat8228/go/src/github.com/rackspace/rack/my_nova.yaml", |
| 387 | "resources": {} |
| 388 | } |
| 389 | }, |
| 390 | "stack_user_project_id": "897686", |
| 391 | "project_id": "897686" |
Jon Perritt | 9209df4 | 2015-02-05 12:55:33 -0700 | [diff] [blame] | 392 | }` |
| 393 | |
| 394 | // HandleAbandonSuccessfully creates an HTTP handler at `/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87/abandon` |
| 395 | // on the test handler mux that responds with an `Abandon` response. |
Pratik Mallya | 827c03e | 2015-09-17 00:10:47 -0500 | [diff] [blame^] | 396 | func HandleAbandonSuccessfully(t *testing.T, output string) { |
| 397 | th.Mux.HandleFunc("/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c8/abandon", func(w http.ResponseWriter, r *http.Request) { |
Jon Perritt | 9209df4 | 2015-02-05 12:55:33 -0700 | [diff] [blame] | 398 | th.TestMethod(t, r, "DELETE") |
| 399 | th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) |
| 400 | th.TestHeader(t, r, "Accept", "application/json") |
| 401 | |
| 402 | w.Header().Set("Content-Type", "application/json") |
| 403 | w.WriteHeader(http.StatusOK) |
Pratik Mallya | 827c03e | 2015-09-17 00:10:47 -0500 | [diff] [blame^] | 404 | fmt.Fprintf(w, output) |
Jon Perritt | 9209df4 | 2015-02-05 12:55:33 -0700 | [diff] [blame] | 405 | }) |
| 406 | } |