blob: 46bc096a3c585fb5715653a266bb3f7f66da962a [file] [log] [blame]
Jamie Hannaford2a130242014-10-28 11:19:46 +01001package users
Jamie Hannaford6a076d82014-10-29 10:57:36 +01002
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
12func MockListResponse(t *testing.T) {
13 th.Mux.HandleFunc("/users", 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 "users":[
23 {
24 "id": "u1000",
25 "username": "jqsmith",
26 "email": "john.smith@example.org",
27 "enabled": true
28 },
29 {
30 "id": "u1001",
31 "username": "jqsmith",
32 "email": "john.smith@example.org",
33 "enabled": true
34 }
35 ]
36}
37 `)
38 })
39}