github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/compute/v2/extensions/pauseunpause/testing/requests_test.go (about)

     1  package testing
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/huaweicloud/golangsdk/openstack/compute/v2/extensions/pauseunpause"
     7  	th "github.com/huaweicloud/golangsdk/testhelper"
     8  	"github.com/huaweicloud/golangsdk/testhelper/client"
     9  )
    10  
    11  const serverID = "{serverId}"
    12  
    13  func TestPause(t *testing.T) {
    14  	th.SetupHTTP()
    15  	defer th.TeardownHTTP()
    16  
    17  	mockPauseServerResponse(t, serverID)
    18  
    19  	err := pauseunpause.Pause(client.ServiceClient(), serverID).ExtractErr()
    20  	th.AssertNoErr(t, err)
    21  }
    22  
    23  func TestUnpause(t *testing.T) {
    24  	th.SetupHTTP()
    25  	defer th.TeardownHTTP()
    26  
    27  	mockUnpauseServerResponse(t, serverID)
    28  
    29  	err := pauseunpause.Unpause(client.ServiceClient(), serverID).ExtractErr()
    30  	th.AssertNoErr(t, err)
    31  }