github.com/franc20/ayesa_sap@v7.0.0-beta.28.0.20200124003224-302d4d52fa6c+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("SEE ALSO:")) 32 Eventually(session).Should(Say("org-quota")) 33 Eventually(session).Should(Exit(0)) 34 }) 35 }) 36 }) 37 38 When("the environment is not setup correctly", func() { 39 It("fails with the appropriate errors", func() { 40 helpers.CheckEnvironmentTargetedCorrectly(false, false, ReadOnlyOrg, "org", "org-name") 41 }) 42 }) 43 44 When("the environment is set up correctly", func() { 45 BeforeEach(func() { 46 helpers.LoginCF() 47 helpers.TargetOrgAndSpace(ReadOnlyOrg, ReadOnlySpace) 48 quotaName = helpers.QuotaName() 49 totalMemory = "24M" 50 instanceMemory = "6M" 51 routes = "8" 52 serviceInstances = "2" 53 appInstances = "3" 54 reservedRoutePorts = "1" 55 session := helpers.CF("create-quota", quotaName, "-m", totalMemory, "-i", instanceMemory, "-r", routes, "-s", serviceInstances, "-a", appInstances, "--allow-paid-service-plans", "--reserved-route-ports", reservedRoutePorts) 56 Eventually(session).Should(Exit(0)) 57 }) 58 59 It("lists the org quotas", func() { 60 session := helpers.CF("org-quotas") 61 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`)) 62 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)) 63 Eventually(session).Should(Exit(0)) 64 }) 65 }) 66 })