github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/integration/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 DescribeTable("everything else", 27 func(expectedError string, flags ...string) { 28 appName := helpers.NewAppName() 29 30 args := append([]string{PushCommandName, appName, "--no-start"}, flags...) 31 session := helpers.CF(args...) 32 Eventually(session.Err).Should(Say(expectedError)) 33 Eventually(session).Should(Exit(1)) 34 }, 35 Entry("no-route and domain", "The following arguments cannot be used together: -d, --no-route", "--no-route", "-d", "some-domain"), 36 Entry("no-route and no-hostname", "The following arguments cannot be used together: --no-hostname, --no-route", "--no-route", "--no-hostname"), 37 Entry("no-route and hostname", "The following arguments cannot be used together: --hostname, -n, --no-route", "--no-route", "--hostname", "some-hostname"), 38 Entry("hostname and no-hostname", "The following arguments cannot be used together: --hostname, -n, --no-hostname", "--hostname", "some-hostname", "--no-hostname"), 39 Entry("random-route and hostname", "The following arguments cannot be used together: --hostname, -n, --random-route", "--hostname", "some-hostname", "--random-route"), 40 Entry("random-route and no-hostname", "The following arguments cannot be used together: --no-hostname, --random-route", "--no-hostname", "--random-route"), 41 Entry("random-route and no-route", "The following arguments cannot be used together: --no-route, --random-route", "--no-route", "--random-route"), 42 Entry("random-route and route path", "The following arguments cannot be used together: --random-route, --route-path", "--random-route", "--route-path", "some-route-path"), 43 Entry("docker-username without image", "Incorrect Usage: '--docker-image, -o' and '--docker-username' must be used together.", "--docker-username", "some-user"), 44 Entry("docker-image and buildpack", "Incorrect Usage: The following arguments cannot be used together: -b, --docker-image, -o", "-o", "some-image", "-b", "some-buidpack"), 45 ) 46 })