github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/vpc/v1/bandwidths/testing/requests_test.go (about)

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