github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/fgs/v2/dependencies/testing/requests_test.go (about)

     1  package testing
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/huaweicloud/golangsdk/openstack/fgs/v2/dependencies"
     7  	"github.com/huaweicloud/golangsdk/pagination"
     8  	th "github.com/huaweicloud/golangsdk/testhelper"
     9  	"github.com/huaweicloud/golangsdk/testhelper/client"
    10  )
    11  
    12  func TestListV2Dependencies(t *testing.T) {
    13  	th.SetupHTTP()
    14  	defer th.TeardownHTTP()
    15  	handleV2DependenciesList(t)
    16  
    17  	actual := make([]dependencies.Dependency, 0)
    18  	err := dependencies.List(client.ServiceClient(), listOpts).EachPage(
    19  		func(page pagination.Page) (bool, error) {
    20  			resp, err := dependencies.ExtractDependencies(page)
    21  			th.AssertNoErr(t, err)
    22  			actual = append(actual, resp.Dependencies...)
    23  			return true, nil
    24  		})
    25  	th.AssertNoErr(t, err)
    26  	th.CheckDeepEquals(t, expectedListResponseData, actual)
    27  }