github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/rts/v1/stackevents/testing/requests_test.go (about) 1 package testing 2 3 import ( 4 "testing" 5 6 "github.com/huaweicloud/golangsdk/openstack/rts/v1/stackevents" 7 "github.com/huaweicloud/golangsdk/pagination" 8 th "github.com/huaweicloud/golangsdk/testhelper" 9 fake "github.com/huaweicloud/golangsdk/testhelper/client" 10 ) 11 12 func TestList(t *testing.T) { 13 th.SetupHTTP() 14 defer th.TeardownHTTP() 15 HandleListSuccessfully(t, ListOutput) 16 17 count := 0 18 err := stackevents.List(fake.ServiceClient(), "hello_world", "49181cd6-169a-4130-9455-31185bbfc5bf", nil).EachPage(func(page pagination.Page) (bool, error) { 19 count++ 20 actual, err := stackevents.ExtractEvents(page) 21 th.AssertNoErr(t, err) 22 23 th.CheckDeepEquals(t, ListExpected, actual) 24 25 return true, nil 26 }) 27 th.AssertNoErr(t, err) 28 th.CheckEquals(t, count, 1) 29 }