github.com/orange-cloudfoundry/cli@v7.1.0+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("Prompts", func() {
    34  		BeforeEach(func() {
    35  			info.Prompts = map[string][]string{"hi": []string{"fake type", "show prompt"}}
    36  		})
    37  
    38  		It("returns the UAA Link", func() {
    39  			Expect(info.LoginPrompts()).To(Equal(map[string][]string{"hi": []string{"fake type", "show prompt"}}))
    40  		})
    41  	})
    42  
    43  	Describe("UAALink", func() {
    44  		BeforeEach(func() {
    45  			info.Links.UAA = "uaa-something"
    46  		})
    47  
    48  		It("returns the UAA Link", func() {
    49  			Expect(info.UAALink()).To(Equal("uaa-something"))
    50  		})
    51  	})
    52  
    53  	Describe("NewInfo", func() {
    54  		When("provided a default link", func() {
    55  			It("sets the links to the provided link", func() {
    56  				link := "something-else-i-don't know"
    57  				info = NewInfo(link)
    58  				Expect(info.LoginLink()).To(Equal(link))
    59  				Expect(info.UAALink()).To(Equal(link))
    60  			})
    61  		})
    62  	})
    63  })