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

     1  package testing
     2  
     3  import (
     4  	"testing"
     5  
     6  	az "github.com/huaweicloud/golangsdk/openstack/compute/v2/extensions/availabilityzones"
     7  	th "github.com/huaweicloud/golangsdk/testhelper"
     8  	"github.com/huaweicloud/golangsdk/testhelper/client"
     9  )
    10  
    11  // Verifies that availability zones can be listed correctly
    12  func TestList(t *testing.T) {
    13  	th.SetupHTTP()
    14  	defer th.TeardownHTTP()
    15  
    16  	HandleGetSuccessfully(t)
    17  
    18  	allPages, err := az.List(client.ServiceClient()).AllPages()
    19  	th.AssertNoErr(t, err)
    20  
    21  	actual, err := az.ExtractAvailabilityZones(allPages)
    22  	th.AssertNoErr(t, err)
    23  
    24  	th.CheckDeepEquals(t, AZResult, actual)
    25  }
    26  
    27  // Verifies that detailed availability zones can be listed correctly
    28  func TestListDetail(t *testing.T) {
    29  	th.SetupHTTP()
    30  	defer th.TeardownHTTP()
    31  
    32  	HandleGetDetailSuccessfully(t)
    33  
    34  	allPages, err := az.ListDetail(client.ServiceClient()).AllPages()
    35  	th.AssertNoErr(t, err)
    36  
    37  	actual, err := az.ExtractAvailabilityZones(allPages)
    38  	th.AssertNoErr(t, err)
    39  
    40  	th.CheckDeepEquals(t, AZDetailResult, actual)
    41  }