github.com/loafoe/cli@v7.1.0+incompatible/integration/v6/push/flag_error_test.go (about) 1 package push 2 3 import ( 4 "code.cloudfoundry.org/cli/integration/helpers" 5 6 . "github.com/onsi/ginkgo" 7 . "github.com/onsi/ginkgo/extensions/table" 8 . "github.com/onsi/gomega" 9 . "github.com/onsi/gomega/gbytes" 10 . "github.com/onsi/gomega/gexec" 11 ) 12 13 var _ = Describe("push flag combination errors", func() { 14 DescribeTable("path and", 15 func(expectedError string, flags ...string) { 16 appName := helpers.NewAppName() 17 18 args := append([]string{PushCommandName, appName, "--no-start", "-p", realDir}, flags...) 19 session := helpers.CF(args...) 20 Eventually(session.Err).Should(Say(expectedError)) 21 Eventually(session).Should(Exit(1)) 22 }, 23 Entry("docker image", "Incorrect Usage: The following arguments cannot be used together: --docker-image, -o, -p", "-o", "some-image"), 24 ) 25 26 Describe("droplet and", func() { 27 Describe("path", func() { 28 It("displays an error", func() { 29 appName := helpers.NewAppName() 30 session := helpers.CF(PushCommandName, appName, "--no-start", "-p", realDir, "--droplet", realDir) 31 Eventually(session.Err).Should(Say("The following arguments cannot be used together: --droplet, -p")) 32 Eventually(session).Should(Exit(1)) 33 }) 34 }) 35 36 Describe("docker image", func() { 37 It("displays an error", func() { 38 appName := helpers.NewAppName() 39 session := helpers.CF(PushCommandName, appName, "--no-start", "--droplet", realDir, "--docker-image", "some-image") 40 Eventually(session.Err).Should(Say("The following arguments cannot be used together: --droplet, --docker-image, -o")) 41 Eventually(session).Should(Exit(1)) 42 }) 43 }) 44 }) 45 46 DescribeTable("everything else", 47 func(expectedError string, flags ...string) { 48 appName := helpers.NewAppName() 49 50 args := append([]string{PushCommandName, appName, "--no-start"}, flags...) 51 session := helpers.CF(args...) 52 Eventually(session.Err).Should(Say(expectedError)) 53 Eventually(session).Should(Exit(1)) 54 }, 55 Entry("no-route and domain", "The following arguments cannot be used together: -d, --no-route", "--no-route", "-d", "some-domain"), 56 Entry("no-route and no-hostname", "The following arguments cannot be used together: --no-hostname, --no-route", "--no-route", "--no-hostname"), 57 Entry("no-route and hostname", "The following arguments cannot be used together: --hostname, -n, --no-route", "--no-route", "--hostname", "some-hostname"), 58 Entry("hostname and no-hostname", "The following arguments cannot be used together: --hostname, -n, --no-hostname", "--hostname", "some-hostname", "--no-hostname"), 59 Entry("random-route and hostname", "The following arguments cannot be used together: --hostname, -n, --random-route", "--hostname", "some-hostname", "--random-route"), 60 Entry("random-route and no-hostname", "The following arguments cannot be used together: --no-hostname, --random-route", "--no-hostname", "--random-route"), 61 Entry("random-route and no-route", "The following arguments cannot be used together: --no-route, --random-route", "--no-route", "--random-route"), 62 Entry("random-route and route path", "The following arguments cannot be used together: --random-route, --route-path", "--random-route", "--route-path", "some-route-path"), 63 Entry("docker-username without image", "Incorrect Usage: '--docker-image, -o' and '--docker-username' must be used together.", "--docker-username", "some-user"), 64 Entry("docker-image and buildpack", "The following arguments cannot be used together: -b, --docker-image, -o", "-o", "some-image", "-b", "some-buidpack"), 65 ) 66 })