github.com/vnpaycloud-console/gophercloud/v2@v2.0.5/openstack/baremetal/apiversions/testing/requests_test.go (about)

     1  package testing
     2  
     3  import (
     4  	"context"
     5  	"testing"
     6  
     7  	"github.com/vnpaycloud-console/gophercloud/v2/openstack/baremetal/apiversions"
     8  	th "github.com/vnpaycloud-console/gophercloud/v2/testhelper"
     9  	"github.com/vnpaycloud-console/gophercloud/v2/testhelper/client"
    10  )
    11  
    12  func TestListAPIVersions(t *testing.T) {
    13  	th.SetupHTTP()
    14  	defer th.TeardownHTTP()
    15  
    16  	MockListResponse(t)
    17  
    18  	actual, err := apiversions.List(context.TODO(), client.ServiceClient()).Extract()
    19  	th.AssertNoErr(t, err)
    20  
    21  	th.AssertDeepEquals(t, IronicAllAPIVersionResults, *actual)
    22  }
    23  
    24  func TestGetAPIVersion(t *testing.T) {
    25  	th.SetupHTTP()
    26  	defer th.TeardownHTTP()
    27  
    28  	MockGetResponse(t)
    29  
    30  	actual, err := apiversions.Get(context.TODO(), client.ServiceClient(), "v1").Extract()
    31  	th.AssertNoErr(t, err)
    32  
    33  	th.AssertDeepEquals(t, IronicAPIVersion1Result, *actual)
    34  }