github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/vpc/v1/bandwidths/testing/requests_test.go (about)

     1  package testing
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/huaweicloud/golangsdk/openstack/vpc/v1/bandwidths"
     7  	th "github.com/huaweicloud/golangsdk/testhelper"
     8  	"github.com/huaweicloud/golangsdk/testhelper/client"
     9  )
    10  
    11  func TestUpdate(t *testing.T) {
    12  	th.SetupHTTP()
    13  	defer th.TeardownHTTP()
    14  	HandleUpdateSuccessfully(t)
    15  
    16  	actual, err := bandwidths.Update(client.ServiceClient(), "3c43e46e-4af1-45b8-a84d-ee6d04488d2a", bandwidths.UpdateOpts{
    17  		Name: "bandwidth-ABCD",
    18  	}).Extract()
    19  	th.AssertNoErr(t, err)
    20  	th.CheckDeepEquals(t, &UpdateResponse, actual)
    21  }
    22  
    23  func TestGet(t *testing.T) {
    24  	th.SetupHTTP()
    25  	defer th.TeardownHTTP()
    26  	HandleGetSuccessfully(t)
    27  
    28  	actual, err := bandwidths.Get(client.ServiceClient(), "3c43e46e-4af1-45b8-a84d-ee6d04488d2a").Extract()
    29  	th.AssertNoErr(t, err)
    30  	th.CheckDeepEquals(t, &GetResponse, actual)
    31  }
    32  
    33  func TestList(t *testing.T) {
    34  	th.SetupHTTP()
    35  	defer th.TeardownHTTP()
    36  	HandleListSuccessfully(t)
    37  
    38  	actual, err := bandwidths.List(client.ServiceClient(), bandwidths.ListOpts{
    39  		Limit: 2,
    40  	}).AllPages()
    41  	th.AssertNoErr(t, err)
    42  	result, err := bandwidths.ExtractBandWidths(actual)
    43  	th.AssertNoErr(t, err)
    44  	th.CheckDeepEquals(t, ListResponse, result)
    45  }