github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/cbr/v3/tasks/testing/requests_test.go (about)

     1  package testing
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/huaweicloud/golangsdk/openstack/cbr/v3/tasks"
     7  	th "github.com/huaweicloud/golangsdk/testhelper"
     8  	"github.com/huaweicloud/golangsdk/testhelper/client"
     9  )
    10  
    11  func TestGetV3Task(t *testing.T) {
    12  	th.SetupHTTP()
    13  	defer th.TeardownHTTP()
    14  	handleTaskGet(t)
    15  
    16  	_, err := tasks.Get(client.ServiceClient(), "4827f2da-b008-4507-ab7d-42d0df5ed912").Extract()
    17  	th.AssertNoErr(t, err)
    18  }
    19  
    20  func TestListV3Task(t *testing.T) {
    21  	th.SetupHTTP()
    22  	defer th.TeardownHTTP()
    23  	handleTaskList(t)
    24  
    25  	pages, err := tasks.List(client.ServiceClient(), tasks.ListOpts{}).AllPages()
    26  	th.AssertNoErr(t, err)
    27  	actual, err := tasks.ExtractTasks(pages)
    28  	th.AssertNoErr(t, err)
    29  	th.AssertDeepEquals(t, expectedListResponseData, actual)
    30  }