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