github.com/sleungcy-sap/cli@v7.1.0+incompatible/integration/v7/global/org_quotas_command_test.go (about) 1 package global 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("org-quotas command", func() { 12 var ( 13 quotaName string 14 15 totalMemory string 16 instanceMemory string 17 routes string 18 serviceInstances string 19 appInstances string 20 reservedRoutePorts string 21 ) 22 23 Describe("help", func() { 24 When("--help flag is set", func() { 25 It("Displays command usage to output", func() { 26 session := helpers.CF("org-quotas", "--help") 27 Eventually(session).Should(Say("NAME:")) 28 Eventually(session).Should(Say("org-quotas - List available organization quotas")) 29 Eventually(session).Should(Say("USAGE:")) 30 Eventually(session).Should(Say("cf org-quotas")) 31 Eventually(session).Should(Say("ALIAS:")) 32 Eventually(session).Should(Say("quotas")) 33 Eventually(session).Should(Say("SEE ALSO:")) 34 Eventually(session).Should(Say("org-quota")) 35 Eventually(session).Should(Exit(0)) 36 }) 37 }) 38 }) 39 40 When("the environment is not setup correctly", func() { 41 It("fails with the appropriate errors", func() { 42 helpers.CheckEnvironmentTargetedCorrectly(false, false, ReadOnlyOrg, "org", "org-name") 43 }) 44 }) 45 46 When("the environment is set up correctly", func() { 47 BeforeEach(func() { 48 helpers.LoginCF() 49 helpers.TargetOrgAndSpace(ReadOnlyOrg, ReadOnlySpace) 50 quotaName = helpers.QuotaName() 51 totalMemory = "24M" 52 instanceMemory = "6M" 53 routes = "8" 54 serviceInstances = "2" 55 appInstances = "3" 56 reservedRoutePorts = "1" 57 session := helpers.CF("create-org-quota", quotaName, "-m", totalMemory, "-i", instanceMemory, "-r", routes, "-s", serviceInstances, "-a", appInstances, "--allow-paid-service-plans", "--reserved-route-ports", reservedRoutePorts) 58 Eventually(session).Should(Exit(0)) 59 }) 60 61 It("lists the org quotas", func() { 62 session := helpers.CF("org-quotas") 63 Eventually(session).Should(Say(`name\s+total memory\s+instance memory\s+routes\s+service instances\s+paid service plans\s+app instances\s+route ports`)) 64 Eventually(session).Should(Say(`%s\s+%s\s+%s\s+%s\s+%s\s+%s\s+%s\s+%s`, quotaName, totalMemory, instanceMemory, routes, serviceInstances, "allowed", appInstances, reservedRoutePorts)) 65 Eventually(session).Should(Exit(0)) 66 }) 67 }) 68 })