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

     1  package testing
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/huaweicloud/golangsdk/openstack/ecs/v1/powers"
     7  	th "github.com/huaweicloud/golangsdk/testhelper"
     8  	"github.com/huaweicloud/golangsdk/testhelper/client"
     9  )
    10  
    11  func TestPowerOnV1(t *testing.T) {
    12  	th.SetupHTTP()
    13  	defer th.TeardownHTTP()
    14  	handlePowerOn(t)
    15  
    16  	actual, err := powers.PowerAction(client.ServiceClient(), powerOpts, "on-start").ExtractJobResponse()
    17  	th.AssertNoErr(t, err)
    18  	th.AssertDeepEquals(t, expectedPowerOnResponseData, actual)
    19  }
    20  
    21  func TestPowerOffV1(t *testing.T) {
    22  	th.SetupHTTP()
    23  	defer th.TeardownHTTP()
    24  	handlePowerOff(t)
    25  
    26  	actual, err := powers.PowerAction(client.ServiceClient(), powerOpts, "on-stop").ExtractJobResponse()
    27  	th.AssertNoErr(t, err)
    28  	th.AssertDeepEquals(t, expectedPowerOffResponseData, actual)
    29  }