blob: 670828a986db1782d88dd1a131757b777f449f09 [file] [log] [blame]
Jamie Hannaford583e23d2014-11-13 13:22:29 +01001package startstop
2
3import (
4 "net/http"
5 "testing"
6
7 th "github.com/rackspace/gophercloud/testhelper"
8 "github.com/rackspace/gophercloud/testhelper/client"
9)
10
11func 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
20func 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}