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

     1  package testing
     2  
     3  import (
     4  	"testing"
     5  
     6  	th "github.com/huaweicloud/golangsdk/testhelper"
     7  )
     8  
     9  func TestBootFromNewVolume(t *testing.T) {
    10  
    11  	actual, err := NewVolumeRequest.ToServerCreateMap()
    12  	th.AssertNoErr(t, err)
    13  	th.CheckJSONEquals(t, ExpectedNewVolumeRequest, actual)
    14  }
    15  
    16  func TestBootFromExistingVolume(t *testing.T) {
    17  	actual, err := ExistingVolumeRequest.ToServerCreateMap()
    18  	th.AssertNoErr(t, err)
    19  	th.CheckJSONEquals(t, ExpectedExistingVolumeRequest, actual)
    20  }
    21  
    22  func TestBootFromImage(t *testing.T) {
    23  	actual, err := ImageRequest.ToServerCreateMap()
    24  	th.AssertNoErr(t, err)
    25  	th.CheckJSONEquals(t, ExpectedImageRequest, actual)
    26  }
    27  
    28  func TestCreateMultiEphemeralOpts(t *testing.T) {
    29  	actual, err := MultiEphemeralRequest.ToServerCreateMap()
    30  	th.AssertNoErr(t, err)
    31  	th.CheckJSONEquals(t, ExpectedMultiEphemeralRequest, actual)
    32  }
    33  
    34  func TestAttachNewVolume(t *testing.T) {
    35  	actual, err := ImageAndNewVolumeRequest.ToServerCreateMap()
    36  	th.AssertNoErr(t, err)
    37  	th.CheckJSONEquals(t, ExpectedImageAndNewVolumeRequest, actual)
    38  }
    39  
    40  func TestAttachExistingVolume(t *testing.T) {
    41  	actual, err := ImageAndExistingVolumeRequest.ToServerCreateMap()
    42  	th.AssertNoErr(t, err)
    43  	th.CheckJSONEquals(t, ExpectedImageAndExistingVolumeRequest, actual)
    44  }