Example #1
0
				cf.Version = "4.5.0"

				testcmd.RunCLICommand("login", Flags, nil, updateCommandDependency, false)

				Expect(ui.Outputs).To(ContainSubstrings(
					[]string{"To upgrade your CLI"},
					[]string{"5.0.0"},
				))
			})
		})

		It("tries to get the organizations", func() {
			Flags = []string{}
			ui.Inputs = []string{"api.example.com", "*****@*****.**", "password", "my-org-1", "my-space"}
			testcmd.RunCLICommand("login", Flags, nil, updateCommandDependency, false)
			Expect(orgRepo.ListOrgsCallCount()).To(Equal(1))
			Expect(orgRepo.ListOrgsArgsForCall(0)).To(Equal(50))
		})

		Describe("when there are too many orgs to show", func() {
			BeforeEach(func() {
				organizations := []models.Organization{}
				for i := 0; i < 60; i++ {
					id := strconv.Itoa(i)
					org := models.Organization{}
					org.GUID = "my-org-guid-" + id
					org.Name = "my-org-" + id
					organizations = append(organizations, org)
				}
				orgRepo.ListOrgsReturns(organizations, nil)
				orgRepo.FindByNameReturns(organizations[1], nil)