[]string{"SPACE DEVELOPER"}, []string{"user4"}, []string{"SPACE AUDITOR"}, []string{"user3"}, )) }) Context("when cc api verson is >= 2.21.0", func() { BeforeEach(func() { configRepo.SetApiVersion("2.22.0") }) It("calls ListUsersInSpaceForRoleWithNoUAA()", func() { runCommand("my-org", "my-sapce") Expect(userRepo.ListUsersInSpaceForRoleWithNoUAACallCount()).To(BeNumerically(">=", 1)) Expect(userRepo.ListUsersInSpaceForRoleCallCount()).To(Equal(0)) }) It("fails with an error when user network call fails", func() { userRepo.ListUsersInSpaceForRoleWithNoUAAStub = func(string, role string) ([]models.UserFields, error) { if role == "SpaceManager" { return []models.UserFields{}, errors.New("internet badness occurred") } return []models.UserFields{}, nil } runCommand("my-org", "my-space") Expect(ui.Outputs).To(BeInDisplayOrder( []string{"Getting users in org", "Org1"}, []string{"internet badness occurred"}, ))