本文整理匯總了Golang中github.com/nttlabs/cli/cf/api/organizations/fakes.FakeOrganizationRepository.ListOrgsReturns方法的典型用法代碼示例。如果您正苦於以下問題:Golang FakeOrganizationRepository.ListOrgsReturns方法的具體用法?Golang FakeOrganizationRepository.ListOrgsReturns怎麽用?Golang FakeOrganizationRepository.ListOrgsReturns使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/nttlabs/cli/cf/api/organizations/fakes.FakeOrganizationRepository
的用法示例。
在下文中一共展示了FakeOrganizationRepository.ListOrgsReturns方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
Context("when everything exists", func() {
BeforeEach(func() {
securityGroup := models.SecurityGroup{
SecurityGroupFields: models.SecurityGroupFields{
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"))
示例2:
ui *testterm.FakeUI
quotaRepo *fakes.FakeSpaceQuotaRepository
orgRepo *test_org.FakeOrganizationRepository
requirementsFactory *testreq.FakeReqFactory
)
BeforeEach(func() {
ui = &testterm.FakeUI{}
quotaRepo = &fakes.FakeSpaceQuotaRepository{}
orgRepo = &test_org.FakeOrganizationRepository{}
requirementsFactory = &testreq.FakeReqFactory{}
org := models.Organization{}
org.Name = "my-org"
org.Guid = "my-org-guid"
orgRepo.ListOrgsReturns([]models.Organization{org}, nil)
orgRepo.FindByNameReturns(org, nil)
})
runCommand := func(args ...string) {
cmd := NewDeleteSpaceQuota(ui, configuration.NewRepositoryWithDefaults(), quotaRepo)
testcmd.RunCommand(cmd, args, requirementsFactory)
}
Context("when the user is not logged in", func() {
BeforeEach(func() {
requirementsFactory.LoginSuccess = false
})
It("fails requirements", func() {
runCommand("my-quota")
示例3:
Expect(testcmd.CommandDidPassRequirements).To(BeFalse())
})
})
Context("when there are orgs to be listed", func() {
BeforeEach(func() {
org1 := models.Organization{}
org1.Name = "Organization-1"
org2 := models.Organization{}
org2.Name = "Organization-2"
org3 := models.Organization{}
org3.Name = "Organization-3"
orgRepo.ListOrgsReturns([]models.Organization{org1, org2, org3}, nil)
})
It("lists orgs", func() {
runCommand()
Expect(ui.Outputs).To(ContainSubstrings(
[]string{"Getting orgs as my-user"},
[]string{"Organization-1"},
[]string{"Organization-2"},
[]string{"Organization-3"},
))
})
})
It("tells the user when no orgs were found", func() {