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

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