github.com/franc20/ayesa_sap@v7.0.0-beta.28.0.20200124003224-302d4d52fa6c+incompatible/integration/v7/global/org_quota_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-quota command", func() { 12 var ( 13 quotaName string 14 ) 15 16 BeforeEach(func() { 17 quotaName = helpers.QuotaName() 18 }) 19 20 Describe("help", func() { 21 When("--help flag is set", func() { 22 It("Displays command usage to output", func() { 23 session := helpers.CF("org-quota", "--help") 24 Eventually(session).Should(Say("NAME:")) 25 Eventually(session).Should(Say("quota - Show organization quota")) 26 Eventually(session).Should(Say("USAGE:")) 27 Eventually(session).Should(Say("cf quota QUOTA")) 28 Eventually(session).Should(Say("SEE ALSO:")) 29 Eventually(session).Should(Say("org, quotas")) 30 Eventually(session).Should(Exit(0)) 31 }) 32 }) 33 }) 34 35 When("the environment is not setup correctly", func() { 36 It("fails with the appropriate errors", func() { 37 helpers.CheckEnvironmentTargetedCorrectly(false, false, ReadOnlyOrg, "org", "org-name") 38 }) 39 }) 40 41 When("the environment is set up correctly", func() { 42 BeforeEach(func() { 43 helpers.LoginCF() 44 }) 45 46 When("the quota does not exist", func() { 47 It("displays quota not found and exits 1", func() { 48 session := helpers.CF("org-quota", quotaName) 49 userName, _ := helpers.GetCredentials() 50 Eventually(session).Should(Say(`Getting org quota %s as %s\.\.\.`, quotaName, userName)) 51 Eventually(session.Err).Should(Say("Quota %s not found", quotaName)) 52 Eventually(session).Should(Say("FAILED")) 53 Eventually(session).Should(Exit(1)) 54 }) 55 }) 56 57 When("the quota exists", func() { 58 When("no flags are used", func() { 59 It("displays a table with quota names and their values and exits 0", func() { 60 session := helpers.CF("org-quota", "default") 61 userName, _ := helpers.GetCredentials() 62 Eventually(session).Should(Say(`Getting org quota %s as %s\.\.\.`, "default", userName)) 63 64 Eventually(session).Should(Say(`total memory:\s+100G`)) 65 Eventually(session).Should(Say(`instance memory:\s+unlimited`)) 66 Eventually(session).Should(Say(`routes:\s+1000`)) 67 Eventually(session).Should(Say(`service instances:\s+unlimited`)) 68 Eventually(session).Should(Say(`paid service plans:\s+allowed`)) 69 Eventually(session).Should(Say(`app instances:\s+unlimited`)) 70 Eventually(session).Should(Say(`route ports:\s+100`)) 71 72 Eventually(session).Should(Exit(0)) 73 }) 74 }) 75 }) 76 }) 77 })