Jamie Hannaford | 583e23d | 2014-11-13 13:22:29 +0100 | [diff] [blame] | 1 | package startstop |
| 2 | |
| 3 | import ( |
| 4 | "net/http" |
| 5 | "testing" |
| 6 | |
| 7 | th "github.com/rackspace/gophercloud/testhelper" |
| 8 | "github.com/rackspace/gophercloud/testhelper/client" |
| 9 | ) |
| 10 | |
| 11 | func mockStartServerResponse(t *testing.T, id string) { |
| 12 | th.Mux.HandleFunc("/servers/"+id+"/action", func(w http.ResponseWriter, r *http.Request) { |
| 13 | th.TestMethod(t, r, "POST") |
| 14 | th.TestHeader(t, r, "X-Auth-Token", client.TokenID) |
| 15 | th.TestJSONRequest(t, r, `{"os-start": null}`) |
| 16 | w.WriteHeader(http.StatusAccepted) |
| 17 | }) |
| 18 | } |
| 19 | |
| 20 | func mockStopServerResponse(t *testing.T, id string) { |
| 21 | th.Mux.HandleFunc("/servers/"+id+"/action", func(w http.ResponseWriter, r *http.Request) { |
| 22 | th.TestMethod(t, r, "POST") |
| 23 | th.TestHeader(t, r, "X-Auth-Token", client.TokenID) |
| 24 | th.TestJSONRequest(t, r, `{"os-stop": null}`) |
| 25 | w.WriteHeader(http.StatusAccepted) |
| 26 | }) |
| 27 | } |