github.com/orange-cloudfoundry/cli@v7.1.0+incompatible/integration/v6/global/buildpacks_command_test.go (about) 1 package global 2 3 import ( 4 "fmt" 5 6 "code.cloudfoundry.org/cli/integration/helpers" 7 . "github.com/onsi/ginkgo" 8 . "github.com/onsi/gomega" 9 . "github.com/onsi/gomega/gbytes" 10 . "github.com/onsi/gomega/gexec" 11 ) 12 13 var _ = Describe("buildpacks command", func() { 14 15 When("--help is passed", func() { 16 It("displays the help message", func() { 17 session := helpers.CF("buildpacks", "--help") 18 Eventually(session).Should(Say("NAME:")) 19 Eventually(session).Should(Say("buildpacks - List all buildpacks")) 20 Eventually(session).Should(Say("USAGE:")) 21 Eventually(session).Should(Say("cf buildpacks")) 22 Eventually(session).Should(Say("SEE ALSO:")) 23 Eventually(session).Should(Say("push")) 24 Eventually(session).Should(Exit(0)) 25 }) 26 }) 27 28 When("environment is not set up", func() { 29 It("displays an error and exits 1", func() { 30 Skip("Unrefactored command is writing login errors to STDOUT; remove skip when refactored") 31 helpers.CheckEnvironmentTargetedCorrectly(false, false, ReadOnlyOrg, "buildpacks") 32 }) 33 34 It("displays an error and exits 1", func() { 35 helpers.UnrefactoredCheckEnvironmentTargetedCorrectly(false, false, ReadOnlyOrg, "buildpacks") 36 }) 37 }) 38 39 When("too many args are passed", func() { 40 It("displays FAILED, then usage, then exits 1", func() { 41 session := helpers.CF("buildpacks", "no-further-args-allowed") 42 Eventually(session).Should(Say("FAILED")) 43 Eventually(session).Should(Say("NAME:")) 44 Eventually(session).Should(Say("buildpacks - List all buildpacks")) 45 Eventually(session).Should(Say("USAGE:")) 46 Eventually(session).Should(Say("cf buildpacks")) 47 Eventually(session).Should(Exit(1)) 48 }) 49 }) 50 51 It("lists the buildpacks with the stack column", func() { 52 helpers.LoginCF() 53 session := helpers.CF("buildpacks") 54 Eventually(session).Should(Say("Getting buildpacks...")) 55 Eventually(session).Should(Say(`buildpack\s+position\s+enabled\s+locked\s+filename\s+stack`)) 56 57 buildpackNameRegex := `staticfile_buildpack` 58 positionRegex := `\d+` 59 boolRegex := `(true|false)` 60 buildpackFileRegex := `staticfile[-_]buildpack-\S+` 61 stackRegex := `(cflinuxfs[23]|windows.+)` 62 63 Eventually(session).Should(Say(fmt.Sprintf(`%s\s+%s\s+%s\s+%s\s+%s\s+%s`, buildpackNameRegex, 64 positionRegex, boolRegex, boolRegex, buildpackFileRegex, stackRegex))) 65 Eventually(session).Should(Exit(0)) 66 }) 67 })