本文整理汇总了Golang中github.com/cloudfoundry/cli/testhelpers/requirements.FakeReqFactory.UserFields方法的典型用法代码示例。如果您正苦于以下问题:Golang FakeReqFactory.UserFields方法的具体用法?Golang FakeReqFactory.UserFields怎么用?Golang FakeReqFactory.UserFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry/cli/testhelpers/requirements.FakeReqFactory
的用法示例。
在下文中一共展示了FakeReqFactory.UserFields方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
Expect(requirementsFactory.OrganizationName).To(Equal("org"))
})
})
Context("when logged in", func() {
BeforeEach(func() {
requirementsFactory.LoginSuccess = true
user := models.UserFields{}
user.Username = "some-user"
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"))
})
示例2:
})
})
Context("when the space is found", func() {
BeforeEach(func() {
space := models.Space{}
space.Guid = "the-space-guid"
space.Name = "the-space-name"
space.Organization = org.OrganizationFields
spaceRepo.FindByNameInOrgReturns(space, nil)
})
Context("when the UserRequirement returns a user with a GUID", func() {
BeforeEach(func() {
userFields := models.UserFields{Guid: "the-user-guid", Username: "the-username"}
requirementsFactory.UserFields = userFields
})
It("tells the user it is assigning the role", func() {
cmd.Execute(flagContext)
Expect(ui.Outputs).To(ContainSubstrings(
[]string{"Assigning role", "SpaceManager", "the-username", "the-org", "the-username"},
[]string{"OK"},
))
})
It("sets the role using the GUID", func() {
cmd.Execute(flagContext)
Expect(userRepo.SetSpaceRoleByGuidCallCount()).To(Equal(1))
actualUserGUID, actualSpaceGUID, actualOrgGUID, actualRole := userRepo.SetSpaceRoleByGuidArgsForCall(0)
Expect(actualUserGUID).To(Equal("the-user-guid"))
示例3:
})
It("fails with usage when not provided exactly three args", func() {
runCommand("one fish", "two fish") // red fish, blue fish
Expect(ui.FailedWithUsage).To(BeTrue())
})
})
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: "my-user"}
requirementsFactory.Organization = org
})
It("sets the given org role on the given user", func() {
runCommand("some-user", "some-org", "OrgManager")
Expect(ui.Outputs).To(ContainSubstrings(
[]string{"Assigning role", "OrgManager", "my-user", "my-org", "my-user"},
[]string{"OK"},
))
Expect(userRepo.SetOrgRoleUserGuid).To(Equal("my-user-guid"))
Expect(userRepo.SetOrgRoleOrganizationGuid).To(Equal("my-org-guid"))
Expect(userRepo.SetOrgRoleRole).To(Equal(models.ORG_MANAGER))
})
})