github.com/willmadison/cli@v6.40.1-0.20181018160101-29d5937903ff+incompatible/api/uaa/info_test.go (about)

     1  package uaa_test
     2  
     3  import (
     4  	. "code.cloudfoundry.org/cli/api/uaa"
     5  
     6  	. "github.com/onsi/ginkgo"
     7  	. "github.com/onsi/gomega"
     8  )
     9  
    10  var _ = Describe("Info", func() {
    11  	var info Info
    12  
    13  	Describe("APIVersion", func() {
    14  		BeforeEach(func() {
    15  			info.App.Version = "api-version"
    16  		})
    17  
    18  		It("returns the version", func() {
    19  			Expect(info.APIVersion()).To(Equal("api-version"))
    20  		})
    21  	})
    22  
    23  	Describe("LoginLink", func() {
    24  		BeforeEach(func() {
    25  			info.Links.Login = "login-something"
    26  		})
    27  
    28  		It("returns the Login Link", func() {
    29  			Expect(info.LoginLink()).To(Equal("login-something"))
    30  		})
    31  	})
    32  
    33  	Describe("UAALink", func() {
    34  		BeforeEach(func() {
    35  			info.Links.UAA = "uaa-something"
    36  		})
    37  
    38  		It("returns the UAA Link", func() {
    39  			Expect(info.UAALink()).To(Equal("uaa-something"))
    40  		})
    41  	})
    42  
    43  	Describe("NewInfo", func() {
    44  		When("provided a default link", func() {
    45  			It("sets the links to the provided link", func() {
    46  				link := "something-else-i-don't know"
    47  				info = NewInfo(link)
    48  				Expect(info.LoginLink()).To(Equal(link))
    49  				Expect(info.UAALink()).To(Equal(link))
    50  			})
    51  		})
    52  	})
    53  })