Example #1
0
		Expect(ui.FailedWithUsage).To(BeTrue())
	})

	Context("when logged in and given some users in the org and space", func() {
		BeforeEach(func() {
			requirementsFactory.LoginSuccess = true

			org := models.Organization{}
			org.Name = "Org1"
			org.Guid = "org1-guid"
			space := models.Space{}
			space.Name = "Space1"
			space.Guid = "space1-guid"

			requirementsFactory.Organization = org
			spaceRepo.FindByNameInOrgSpace = space

			user := models.UserFields{}
			user.Username = "******"
			user2 := models.UserFields{}
			user2.Username = "******"
			user3 := models.UserFields{}
			user3.Username = "******"
			user4 := models.UserFields{}
			user4.Username = "******"
			userRepo.ListUsersByRole = map[string][]models.UserFields{
				models.SPACE_MANAGER:   []models.UserFields{user, user2},
				models.SPACE_DEVELOPER: []models.UserFields{user4},
				models.SPACE_AUDITOR:   []models.UserFields{user3},
			}
		})
Example #2
0
			Expect(requirementsFactory.OrganizationName).To(Equal("org"))
		})
	})

	Context("when logged in", func() {
		BeforeEach(func() {
			requirementsFactory.LoginSuccess = true

			org := models.Organization{}
			org.Guid = "my-org-guid"
			org.Name = "my-org"

			requirementsFactory.UserFields = models.UserFields{Guid: "my-user-guid", Username: "******"}
			requirementsFactory.Organization = org

			spaceRepo.FindByNameInOrgSpace = models.Space{}
			spaceRepo.FindByNameInOrgSpace.Guid = "my-space-guid"
			spaceRepo.FindByNameInOrgSpace.Name = "my-space"
			spaceRepo.FindByNameInOrgSpace.Organization = org.OrganizationFields
		})

		It("sets the given space role on the given user", func() {
			runCommand("some-user", "some-org", "some-space", "SpaceManager")

			Expect(ui.Outputs).To(ContainSubstrings(
				[]string{"Assigning role ", "SpaceManager", "my-user", "my-org", "my-space", "current-user"},
				[]string{"OK"},
			))

			Expect(spaceRepo.FindByNameInOrgName).To(Equal("some-space"))
			Expect(spaceRepo.FindByNameInOrgOrgGuid).To(Equal("my-org-guid"))