github.com/gophercloud/gophercloud@v1.11.0/openstack/containerinfra/v1/quotas/testing/requests_test.go (about) 1 package testing 2 3 import ( 4 "testing" 5 6 "github.com/gophercloud/gophercloud/openstack/containerinfra/v1/quotas" 7 th "github.com/gophercloud/gophercloud/testhelper" 8 fake "github.com/gophercloud/gophercloud/testhelper/client" 9 ) 10 11 func TestCreateQuota(t *testing.T) { 12 th.SetupHTTP() 13 defer th.TeardownHTTP() 14 15 HandleCreateQuotaSuccessfully(t) 16 17 opts := quotas.CreateOpts{ 18 ProjectID: "aa5436ab58144c768ca4e9d2e9f5c3b2", 19 Resource: "Cluster", 20 HardLimit: 10, 21 } 22 23 sc := fake.ServiceClient() 24 sc.Endpoint = sc.Endpoint + "v1/" 25 26 res := quotas.Create(sc, opts) 27 th.AssertNoErr(t, res.Err) 28 29 requestID := res.Header.Get("X-OpenStack-Request-Id") 30 th.AssertEquals(t, requestUUID, requestID) 31 32 quota, err := res.Extract() 33 th.AssertNoErr(t, err) 34 35 th.AssertDeepEquals(t, projectID, quota.ProjectID) 36 }