本文整理匯總了Golang中github.com/nttlabs/cli/testhelpers/requirements.FakeReqFactory.UserFields方法的典型用法代碼示例。如果您正苦於以下問題:Golang FakeReqFactory.UserFields方法的具體用法?Golang FakeReqFactory.UserFields怎麽用?Golang FakeReqFactory.UserFields使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/nttlabs/cli/testhelpers/requirements.FakeReqFactory
的用法示例。
在下文中一共展示了FakeReqFactory.UserFields方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
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: "my-user"}
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:
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"))
})