github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/cci/v1/persistentvolumeclaims/testing/requests_test.go (about) 1 package testing 2 3 import ( 4 "testing" 5 6 "github.com/huaweicloud/golangsdk/openstack/cci/v1/persistentvolumeclaims" 7 th "github.com/huaweicloud/golangsdk/testhelper" 8 "github.com/huaweicloud/golangsdk/testhelper/client" 9 ) 10 11 func TestCreateOptsMarshall(t *testing.T) { 12 res, err := createOpts.ToPVCCreateMap() 13 th.AssertNoErr(t, err) 14 th.AssertJSONEquals(t, expectedRequest, res) 15 } 16 17 func TestCreateV1PersistentVolumeClaim(t *testing.T) { 18 th.SetupHTTP() 19 defer th.TeardownHTTP() 20 handlePersistentVolumeClaimCreate(t) 21 22 actual, err := persistentvolumeclaims.Create(client.ServiceClient(), createOpts, "terraform-test").Extract() 23 th.AssertNoErr(t, err) 24 th.AssertDeepEquals(t, expectedCreateResponseData, actual) 25 } 26 27 func TestListV1PersistentVolumeClaim(t *testing.T) { 28 th.SetupHTTP() 29 defer th.TeardownHTTP() 30 handlePersistentVolumeClaimList(t) 31 32 pages, err := persistentvolumeclaims.List(client.ServiceClient(), listOpts, "terraform-test").AllPages() 33 th.AssertNoErr(t, err) 34 actual, err := persistentvolumeclaims.ExtractPersistentVolumeClaims(pages) 35 th.AssertNoErr(t, err) 36 th.AssertDeepEquals(t, expectedListResponseData, actual) 37 }