github.com/gophercloud/gophercloud@v1.11.0/openstack/containerinfra/v1/quotas/testing/fixtures_test.go (about) 1 package testing 2 3 import ( 4 "fmt" 5 "net/http" 6 "testing" 7 8 th "github.com/gophercloud/gophercloud/testhelper" 9 fake "github.com/gophercloud/gophercloud/testhelper/client" 10 ) 11 12 const projectID = "aa5436ab58144c768ca4e9d2e9f5c3b2" 13 const requestUUID = "req-781e9bdc-4163-46eb-91c9-786c53188bbb" 14 15 var CreateResponse = fmt.Sprintf(` 16 { 17 "resource": "Cluster", 18 "created_at": "2017-01-17T17:35:48+00:00", 19 "updated_at": null, 20 "hard_limit": 1, 21 "project_id": "%s", 22 "id": 26 23 }`, projectID) 24 25 func HandleCreateQuotaSuccessfully(t *testing.T) { 26 th.Mux.HandleFunc("/v1/quotas", func(w http.ResponseWriter, r *http.Request) { 27 th.TestMethod(t, r, "POST") 28 th.TestHeader(t, r, "X-Auth-Token", fake.TokenID) 29 30 w.Header().Add("Content-Type", "application/json") 31 w.Header().Add("X-OpenStack-Request-Id", requestUUID) 32 w.WriteHeader(http.StatusCreated) 33 34 fmt.Fprint(w, CreateResponse) 35 }) 36 }