コード例 #1
0
ファイル: set_space_role_test.go プロジェクト: nttlabs/cli
			Expect(testcmd.CommandDidPassRequirements).To(BeTrue())
			Expect(requirementsFactory.UserUsername).To(Equal("username"))
			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"},
			))
コード例 #2
0
ファイル: unset_org_role_test.go プロジェクト: nttlabs/cli
			Expect(requirementsFactory.OrganizationName).To(Equal("org"))
		})
	})

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

			user := models.UserFields{}
			user.Username = "******"
			user.Guid = "some-user-guid"
			org := models.Organization{}
			org.Name = "some-org"
			org.Guid = "some-org-guid"

			requirementsFactory.UserFields = user
			requirementsFactory.Organization = org
		})

		It("unsets a user's org role", func() {
			runCommand("my-username", "my-org", "OrgManager")

			Expect(ui.Outputs).To(ContainSubstrings(
				[]string{"Removing role", "OrgManager", "my-username", "my-org", "my-user"},
				[]string{"OK"},
			))

			Expect(userRepo.UnsetOrgRoleRole).To(Equal(models.ORG_MANAGER))
			Expect(userRepo.UnsetOrgRoleUserGuid).To(Equal("some-user-guid"))
			Expect(userRepo.UnsetOrgRoleOrganizationGuid).To(Equal("some-org-guid"))
		})