github.com/swisscom/cloudfoundry-cli@v7.1.0+incompatible/integration/v7/isolated/space_quotas_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("space-quotas command", func() { 12 var ( 13 quotaName string 14 orgName string 15 userName string 16 17 totalMemory string 18 instanceMemory string 19 routes string 20 serviceInstances string 21 appInstances string 22 reservedRoutePorts string 23 ) 24 25 Describe("help", func() { 26 When("--help flag is set", func() { 27 It("Displays command usage to output", func() { 28 session := helpers.CF("space-quotas", "--help") 29 Eventually(session).Should(Say("NAME:")) 30 Eventually(session).Should(Say("space-quotas - List available space quotas")) 31 Eventually(session).Should(Say("USAGE:")) 32 Eventually(session).Should(Say("cf space-quotas")) 33 Eventually(session).Should(Say("SEE ALSO:")) 34 Eventually(session).Should(Say("set-space-quota, space-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(true, false, ReadOnlyOrg, "space-quotas") 43 }) 44 }) 45 46 When("the environment is setup correctly", func() { 47 BeforeEach(func() { 48 orgName = helpers.NewOrgName() 49 userName = helpers.LoginCF() 50 helpers.SetupCFWithOrgOnly(orgName) 51 quotaName = helpers.QuotaName() 52 totalMemory = "24M" 53 instanceMemory = "6M" 54 routes = "8" 55 serviceInstances = "2" 56 appInstances = "-1" 57 reservedRoutePorts = "1" 58 session := helpers.CF("create-space-quota", quotaName, "-m", totalMemory, "-i", instanceMemory, "-r", routes, "-s", serviceInstances, "-a", appInstances, "--allow-paid-service-plans", "--reserved-route-ports", reservedRoutePorts) 59 Eventually(session).Should(Exit(0)) 60 }) 61 62 It("lists the space quotas", func() { 63 session := helpers.CF("space-quotas") 64 Eventually(session).Should(Say(`Getting space quotas for org %s as %s\.\.\.`, orgName, userName)) 65 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`)) 66 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", "unlimited", reservedRoutePorts)) 67 Eventually(session).Should(Exit(0)) 68 }) 69 70 }) 71 })