github.com/jenspinney/cli@v6.42.1-0.20190207184520-7450c600020e+incompatible/integration/v7/isolated/buildpacks_command_test.go (about) 1 package isolated 2 3 import ( 4 "code.cloudfoundry.org/cli/integration/helpers" 5 . "github.com/onsi/ginkgo" 6 . "github.com/onsi/gomega" 7 . "github.com/onsi/gomega/gbytes" 8 . "github.com/onsi/gomega/gexec" 9 ) 10 11 var _ = Describe("buildpacks command", func() { 12 When("--help is passed", func() { 13 It("displays the help message", func() { 14 session := helpers.CF("buildpacks", "--help") 15 Eventually(session).Should(Say("NAME:")) 16 Eventually(session).Should(Say("buildpacks - List all buildpacks")) 17 Eventually(session).Should(Say("USAGE:")) 18 Eventually(session).Should(Say("cf buildpacks")) 19 Eventually(session).Should(Say("SEE ALSO:")) 20 Eventually(session).Should(Say("push")) 21 Eventually(session).Should(Exit(0)) 22 }) 23 }) 24 25 When("environment is not set up", func() { 26 It("displays an error and exits 1", func() { 27 helpers.CheckEnvironmentTargetedCorrectly(false, false, ReadOnlyOrg, "buildpacks") 28 }) 29 }) 30 31 When("the targeted API supports stack association", func() { 32 BeforeEach(func() { 33 helpers.LoginCF() 34 }) 35 36 It("lists the buildpacks with the stack column", func() { 37 session := helpers.CF("buildpacks") 38 39 username, _ := helpers.GetCredentials() 40 Eventually(session).Should(Say("Getting buildpacks as %s...", username)) 41 Eventually(session).Should(Say(`position\s+name\s+stack\s+enabled\s+locked\s+filename`)) 42 43 positionRegex := `\d+` 44 enabledRegex := `true` 45 lockedRegex := `false` 46 stackRegex := `(cflinuxfs[23]|windows.+)` 47 48 staticfileNameRegex := `staticfile_buildpack` 49 // staticfileFileRegex := `staticfile[-_]buildpack-\S+` 50 staticfileFileRegex := "" 51 Eventually(session).Should(Say(`%s\s+%s\s+%s\s+%s\s+%s\s+%s`, 52 positionRegex, 53 staticfileNameRegex, 54 stackRegex, 55 enabledRegex, 56 lockedRegex, 57 staticfileFileRegex)) 58 59 binaryNameRegex := `binary_buildpack` 60 // binaryFileRegex := `binary[-_]buildpack-\S+` 61 binaryFileRegex := "" 62 Eventually(session).Should(Say(`%s\s+%s\s+%s\s+%s\s+%s\s+%s`, 63 positionRegex, 64 binaryNameRegex, 65 stackRegex, 66 enabledRegex, 67 lockedRegex, 68 binaryFileRegex)) 69 Eventually(session).Should(Exit(0)) 70 }) 71 }) 72 })