Ejemplo n.º 1
0
				[]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 models.Role) ([]models.UserFields, error) {
					if role == models.RoleSpaceManager {
						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"},
				))