github.com/orange-cloudfoundry/cli@v7.1.0+incompatible/command/translatableerror/missing_credential_error_test.go (about) 1 package translatableerror_test 2 3 import ( 4 . "code.cloudfoundry.org/cli/command/translatableerror" 5 6 . "github.com/onsi/ginkgo" 7 . "github.com/onsi/gomega" 8 ) 9 10 var _ = Describe("MissingCredentialsError", func() { 11 Describe("Error", func() { 12 When("username was not provided", func() { 13 It("prints a message asking for username", func() { 14 err := MissingCredentialsError{ 15 MissingUsername: true, 16 } 17 18 Expect(err.Error()).To(Equal("Username not provided.")) 19 }) 20 }) 21 22 When("password was not provided", func() { 23 It("prints a message asking for username", func() { 24 err := MissingCredentialsError{ 25 MissingPassword: true, 26 } 27 28 Expect(err.Error()).To(Equal("Password not provided.")) 29 }) 30 }) 31 32 When("neither username nor password was provided", func() { 33 It("prints a message asking for username", func() { 34 err := MissingCredentialsError{ 35 MissingUsername: true, 36 MissingPassword: true, 37 } 38 39 Expect(err.Error()).To(Equal("Username and password not provided.")) 40 }) 41 }) 42 }) 43 })