Ejemplo n.º 1
0
				userRepo.ListUsersInSpaceForRole_CallCount = 0
				userRepo.ListUsersInSpaceForRoleWithNoUAA_CallCount = 0
				configRepo.SetApiVersion("2.22.0")
			})

			It("calls ListUsersInSpaceForRoleWithNoUAA()", func() {
				runCommand("my-org", "my-sapce")

				Expect(userRepo.ListUsersInSpaceForRoleWithNoUAA_CallCount).To(BeNumerically(">=", 1))
				Expect(userRepo.ListUsersInSpaceForRole_CallCount).To(Equal(0))
			})

			It("fails with an error when user network call fails", func() {
				userRepo.StubbedError = func(string, role string) error {
					if role == "SpaceManager" {
						return errors.New("internet badness occurred")
					}
					return nil
				}
				runCommand("my-org", "my-space")
				Expect(ui.Outputs).To(BeInDisplayOrder(
					[]string{"Getting users in org", "Org1"},
					[]string{"internet badness occurred"},
				))
			})
		})

		Context("when cc api verson is < 2.21.0", func() {
			It("calls ListUsersInSpaceForRole()", func() {
				configRepo.SetApiVersion("2.20.0")
				runCommand("my-org", "my-space")