github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/integration/isolated/ssh_code_command_test.go (about) 1 package isolated 2 3 import ( 4 "code.cloudfoundry.org/cli/integration/helpers" 5 6 . "github.com/onsi/ginkgo" 7 . "github.com/onsi/gomega" 8 . "github.com/onsi/gomega/gbytes" 9 . "github.com/onsi/gomega/gexec" 10 ) 11 12 var _ = Describe("ssh-code command", func() { 13 Describe("help", func() { 14 Context("when --help flag is set", func() { 15 It("displays command usage to output", func() { 16 session := helpers.CF("ssh-code", "--help") 17 Eventually(session).Should(Say("NAME:")) 18 Eventually(session).Should(Say("ssh-code - Get a one time password for ssh clients")) 19 Eventually(session).Should(Say("USAGE:")) 20 Eventually(session).Should(Say("cf ssh-code")) 21 Eventually(session).Should(Say("SEE ALSO:")) 22 Eventually(session).Should(Say("curl, ssh")) 23 Eventually(session).Should(Exit(0)) 24 }) 25 }) 26 }) 27 28 Context("when the environment is not setup correctly", func() { 29 It("fails with the appropriate errors", func() { 30 helpers.CheckEnvironmentTargetedCorrectly(false, false, ReadOnlyOrg, "ssh-code") 31 }) 32 }) 33 34 Context("when the environment is setup correctly", func() { 35 BeforeEach(func() { 36 helpers.LoginCF() 37 }) 38 39 It("returns a one time passcode for ssh", func() { 40 session := helpers.CF("ssh-code") 41 Eventually(session).Should(Say("[A-Za-z0-9]+")) 42 Eventually(session).Should(Exit(0)) 43 }) 44 }) 45 })