本文整理匯總了Golang中github.com/nttlabs/cli/cf/api/fakes.FakeSpaceRepository.FindByNameInOrgSpace方法的典型用法代碼示例。如果您正苦於以下問題:Golang FakeSpaceRepository.FindByNameInOrgSpace方法的具體用法?Golang FakeSpaceRepository.FindByNameInOrgSpace怎麽用?Golang FakeSpaceRepository.FindByNameInOrgSpace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/nttlabs/cli/cf/api/fakes.FakeSpaceRepository
的用法示例。
在下文中一共展示了FakeSpaceRepository.FindByNameInOrgSpace方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
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 = "user1"
user2 := models.UserFields{}
user2.Username = "user2"
user3 := models.UserFields{}
user3.Username = "user3"
user4 := models.UserFields{}
user4.Username = "user4"
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:
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"},
))
Expect(spaceRepo.FindByNameInOrgName).To(Equal("some-space"))
Expect(spaceRepo.FindByNameInOrgOrgGuid).To(Equal("my-org-guid"))
示例3:
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() {