github.com/scaleway/scaleway-cli@v1.11.1/pkg/pricing/pricing_test.go (about)

     1  package pricing
     2  
     3  import (
     4  	"testing"
     5  
     6  	. "github.com/smartystreets/goconvey/convey"
     7  )
     8  
     9  func TestGetByPath(t *testing.T) {
    10  	Convey("Testing GetByPath", t, func() {
    11  		object := CurrentPricing.GetByPath("/compute/c1/run")
    12  		So(object, ShouldNotBeNil)
    13  		So(object.Path, ShouldEqual, "/compute/c1/run")
    14  
    15  		object = CurrentPricing.GetByPath("/ip/dynamic")
    16  		So(object, ShouldNotBeNil)
    17  		So(object.Path, ShouldEqual, "/ip/dynamic")
    18  
    19  		object = CurrentPricing.GetByPath("/dontexists")
    20  		So(object, ShouldBeNil)
    21  	})
    22  }
    23  
    24  func TestGetByIdentifier(t *testing.T) {
    25  	Convey("Testing GetByIdentifier", t, func() {
    26  		object := CurrentPricing.GetByIdentifier("aaaaaaaa-aaaa-4aaa-8aaa-111111111112")
    27  		So(object, ShouldNotBeNil)
    28  		So(object.Path, ShouldEqual, "/compute/c1/run")
    29  
    30  		object = CurrentPricing.GetByIdentifier("dontexists")
    31  		So(object, ShouldBeNil)
    32  	})
    33  }