github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/identity/v2/extensions/testing/delegate_test.go (about) 1 package testing 2 3 import ( 4 "testing" 5 6 common "github.com/huaweicloud/golangsdk/openstack/common/extensions/testing" 7 "github.com/huaweicloud/golangsdk/openstack/identity/v2/extensions" 8 "github.com/huaweicloud/golangsdk/pagination" 9 th "github.com/huaweicloud/golangsdk/testhelper" 10 "github.com/huaweicloud/golangsdk/testhelper/client" 11 ) 12 13 func TestList(t *testing.T) { 14 th.SetupHTTP() 15 defer th.TeardownHTTP() 16 HandleListExtensionsSuccessfully(t) 17 18 count := 0 19 err := extensions.List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { 20 count++ 21 actual, err := extensions.ExtractExtensions(page) 22 th.AssertNoErr(t, err) 23 th.CheckDeepEquals(t, common.ExpectedExtensions, actual) 24 25 return true, nil 26 }) 27 th.AssertNoErr(t, err) 28 th.CheckEquals(t, 1, count) 29 } 30 31 func TestGet(t *testing.T) { 32 th.SetupHTTP() 33 defer th.TeardownHTTP() 34 common.HandleGetExtensionSuccessfully(t) 35 36 actual, err := extensions.Get(client.ServiceClient(), "agent").Extract() 37 th.AssertNoErr(t, err) 38 th.CheckDeepEquals(t, common.SingleExtension, actual) 39 }