blob: 0b11338d21366dbee3a2fe02e2b4d4f74d097e62 [file] [log] [blame]
Jamie Hannaford17d2f872014-11-24 12:20:33 +01001package defsecrules
2
3import (
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
12const rootPath = "/os-security-group-default-rules"
13
14func mockListRulesResponse(t *testing.T) {
15 th.Mux.HandleFunc(rootPath, func(w http.ResponseWriter, r *http.Request) {
16 th.TestMethod(t, r, "GET")
17 th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
18
19 w.Header().Add("Content-Type", "application/json")
20 w.WriteHeader(http.StatusOK)
21
22 fmt.Fprintf(w, `
23{
24 "security_group_default_rules": [
25 {
26 "from_port": 80,
27 "id": "f9a97fcf-3a97-47b0-b76f-919136afb7ed",
28 "ip_protocol": "TCP",
29 "ip_range": {
30 "cidr": "10.10.10.0/24"
31 },
32 "to_port": 80
33 }
34 ]
35}
36 `)
37 })
38}