コード例 #1
0
ファイル: space_users_test.go プロジェクト: nttlabs/cli
		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},
			}
		})
コード例 #2
0
ファイル: set_space_role_test.go プロジェクト: nttlabs/cli
			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"))
コード例 #3
0
						Name:  "my-group",
						Guid:  "my-group-guid",
						Rules: []map[string]interface{}{},
					},
				}

				securityGroupRepo.ReadReturns(securityGroup, nil)

				orgRepo.ListOrgsReturns([]models.Organization{{
					OrganizationFields: models.OrganizationFields{
						Name: "my-org",
						Guid: "my-org-guid",
					}},
				}, nil)

				spaceRepo.FindByNameInOrgSpace = models.Space{SpaceFields: models.SpaceFields{Name: "my-space", Guid: "my-space-guid"}}
			})

			It("removes the security group when we only pass the security group name (using the targeted org and space)", func() {
				runCommand("my-group")

				Expect(ui.Outputs).To(ContainSubstrings(
					[]string{"Unbinding security group", "my-org", "my-space", "my-user"},
					[]string{"OK"},
				))
				securityGroupGuid, spaceGuid := secBinder.UnbindSpaceArgsForCall(0)
				Expect(securityGroupGuid).To(Equal("my-group-guid"))
				Expect(spaceGuid).To(Equal("my-space-guid"))
			})

			It("removes the security group when we pass the org and space", func() {