blob: df836e8952cd3d860964b3a2851e3543012c0f5c [file] [log] [blame]
Dan Kirkwoodceb84092016-03-01 13:58:34 -07001// +build fixtures
2
Dan Kirkwoodc0a80992016-03-07 13:47:25 -07003package quotasets
Dan Kirkwoodceb84092016-03-01 13:58:34 -07004
5import (
6 "fmt"
7 "net/http"
8 "testing"
9
10 th "github.com/rackspace/gophercloud/testhelper"
11 "github.com/rackspace/gophercloud/testhelper/client"
12)
13
14// GetOutput is a sample response to a Get call.
15const GetOutput = `
16{
17 "quota_set" : {
18 "instances" : 25,
19 "security_groups" : 10,
20 "security_group_rules" : 20,
21 "cores" : 200,
22 "injected_file_content_bytes" : 10240,
23 "injected_files" : 5,
24 "metadata_items" : 128,
25 "ram" : 200000,
26 "keypairs" : 10,
27 "injected_file_path_bytes" : 255
28 }
29}
30`
31
32const FirstTenantID = "555544443333222211110000ffffeeee"
33
Dan Kirkwoodc0a80992016-03-07 13:47:25 -070034// FirstQuotaset is the first result in ListOutput.
35var FirstQuota = Quotaset{
Dan Kirkwoodceb84092016-03-01 13:58:34 -070036 FixedIps: 0,
37 FloatingIps: 0,
38 InjectedFileContentBytes: 10240,
39 InjectedFilePathBytes: 255,
40 InjectedFiles: 5,
41 KeyPairs: 10,
42 MetadataItems: 128,
43 Ram: 200000,
44 SecurityGroupRules: 20,
45 SecurityGroups: 10,
46 Cores: 200,
47 Instances: 25,
48}
49
50// HandleGetSuccessfully configures the test server to respond to a Get request for sample tenant
51func HandleGetSuccessfully(t *testing.T) {
52 th.Mux.HandleFunc("/os-quota-sets/"+FirstTenantID, func(w http.ResponseWriter, r *http.Request) {
53 th.TestMethod(t, r, "GET")
54 th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
55
56 w.Header().Add("Content-Type", "application/json")
57 fmt.Fprintf(w, GetOutput)
58 })
59}