github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/apigw/v2/authorizers/testing/requests_test.go (about) 1 package testing 2 3 import ( 4 "testing" 5 6 "github.com/huaweicloud/golangsdk/openstack/apigw/v2/authorizers" 7 th "github.com/huaweicloud/golangsdk/testhelper" 8 "github.com/huaweicloud/golangsdk/testhelper/client" 9 ) 10 11 func TestCreateV2CustomAuthorizer(t *testing.T) { 12 th.SetupHTTP() 13 defer th.TeardownHTTP() 14 handleV2CustomAuthorizerCreate(t) 15 16 actual, err := authorizers.Create(client.ServiceClient(), "6da953fe33d44650a067e43a4593368b", 17 createOpts).Extract() 18 th.AssertNoErr(t, err) 19 th.AssertDeepEquals(t, expectedGetResponseData, actual) 20 } 21 22 func TestGetV2CustomAuthorizer(t *testing.T) { 23 th.SetupHTTP() 24 defer th.TeardownHTTP() 25 handleV2CustomAuthorizerGet(t) 26 27 actual, err := authorizers.Get(client.ServiceClient(), "6da953fe33d44650a067e43a4593368b", 28 "0d2a523974a14fe1a25c1bc2f61b2d9d").Extract() 29 th.AssertNoErr(t, err) 30 th.AssertDeepEquals(t, expectedGetResponseData, actual) 31 } 32 33 func TestListV2CustomAuthorizer(t *testing.T) { 34 th.SetupHTTP() 35 defer th.TeardownHTTP() 36 handleV2CustomAuthorizerList(t) 37 38 pages, err := authorizers.List(client.ServiceClient(), "6da953fe33d44650a067e43a4593368b", 39 listOpts).AllPages() 40 th.AssertNoErr(t, err) 41 actual, err := authorizers.ExtractCustomAuthorizers(pages) 42 th.AssertNoErr(t, err) 43 th.AssertDeepEquals(t, expectedListResponseData, actual) 44 } 45 46 func TestUpdateV2CustomAuthorizer(t *testing.T) { 47 th.SetupHTTP() 48 defer th.TeardownHTTP() 49 handleV2CustomAuthorizerUpdate(t) 50 51 actual, err := authorizers.Update(client.ServiceClient(), "6da953fe33d44650a067e43a4593368b", 52 "0d2a523974a14fe1a25c1bc2f61b2d9d", createOpts).Extract() 53 th.AssertNoErr(t, err) 54 th.AssertDeepEquals(t, expectedGetResponseData, actual) 55 } 56 57 func TestDeleteV2CustomAuthorizer(t *testing.T) { 58 th.SetupHTTP() 59 defer th.TeardownHTTP() 60 handleV2CustomAuthorizerDelete(t) 61 62 err := authorizers.Delete(client.ServiceClient(), "6da953fe33d44650a067e43a4593368b", 63 "0d2a523974a14fe1a25c1bc2f61b2d9d").ExtractErr() 64 th.AssertNoErr(t, err) 65 }