| package testing |
| |
| import ( |
| "net/http" |
| "testing" |
| |
| th "gerrit.mcp.mirantis.net/debian/gophercloud.git/testhelper" |
| "gerrit.mcp.mirantis.net/debian/gophercloud.git/testhelper/client" |
| ) |
| |
| func mockStartServerResponse(t *testing.T, id string) { |
| th.Mux.HandleFunc("/servers/"+id+"/action", func(w http.ResponseWriter, r *http.Request) { |
| th.TestMethod(t, r, "POST") |
| th.TestHeader(t, r, "X-Auth-Token", client.TokenID) |
| th.TestJSONRequest(t, r, `{"os-start": null}`) |
| w.WriteHeader(http.StatusAccepted) |
| }) |
| } |
| |
| func mockStopServerResponse(t *testing.T, id string) { |
| th.Mux.HandleFunc("/servers/"+id+"/action", func(w http.ResponseWriter, r *http.Request) { |
| th.TestMethod(t, r, "POST") |
| th.TestHeader(t, r, "X-Auth-Token", client.TokenID) |
| th.TestJSONRequest(t, r, `{"os-stop": null}`) |
| w.WriteHeader(http.StatusAccepted) |
| }) |
| } |