Jamie Hannaford | 924c09d | 2014-11-19 12:05:38 +0100 | [diff] [blame^] | 1 | package secgroups |
| 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | "net/http" |
| 6 | "testing" |
| 7 | |
| 8 | th "github.com/rackspace/gophercloud/testhelper" |
| 9 | fake "github.com/rackspace/gophercloud/testhelper/client" |
| 10 | ) |
| 11 | |
| 12 | func mockListGroupsResponse(t *testing.T) { |
| 13 | th.Mux.HandleFunc("/os-security-groups", func(w http.ResponseWriter, r *http.Request) { |
| 14 | th.TestMethod(t, r, "GET") |
| 15 | th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) |
| 16 | |
| 17 | w.Header().Add("Content-Type", "application/json") |
| 18 | w.WriteHeader(http.StatusOK) |
| 19 | |
| 20 | fmt.Fprintf(w, ` |
| 21 | { |
| 22 | "security_groups": [ |
| 23 | { |
| 24 | "description": "default", |
| 25 | "id": "b0e0d7dd-2ca4-49a9-ba82-c44a148b66a5", |
| 26 | "name": "default", |
| 27 | "rules": [], |
| 28 | "tenant_id": "openstack" |
| 29 | } |
| 30 | ] |
| 31 | } |
| 32 | `) |
| 33 | }) |
| 34 | } |