github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/identity/v3/catalog/testing/catalog_test.go (about)

     1  package testing
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/opentelekomcloud/gophertelekomcloud/openstack/identity/v3/catalog"
     7  	"github.com/opentelekomcloud/gophertelekomcloud/pagination"
     8  	th "github.com/opentelekomcloud/gophertelekomcloud/testhelper"
     9  	"github.com/opentelekomcloud/gophertelekomcloud/testhelper/client"
    10  )
    11  
    12  func TestListCatalog(t *testing.T) {
    13  	th.SetupHTTP()
    14  	defer th.TeardownHTTP()
    15  	HandleListCatalogSuccessfully(t)
    16  
    17  	count := 0
    18  	err := catalog.List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) {
    19  		count++
    20  
    21  		actual, err := catalog.ExtractServiceCatalog(page)
    22  		th.AssertNoErr(t, err)
    23  
    24  		th.CheckDeepEquals(t, ExpectedCatalogSlice, actual)
    25  
    26  		return true, nil
    27  	})
    28  	th.AssertNoErr(t, err)
    29  	th.CheckEquals(t, count, 1)
    30  }