本文整理匯總了Golang中github.com/cloudfoundry/cli/cf/api/fakes.FakeServiceBrokerRepo.ServiceBrokers方法的典型用法代碼示例。如果您正苦於以下問題:Golang FakeServiceBrokerRepo.ServiceBrokers方法的具體用法?Golang FakeServiceBrokerRepo.ServiceBrokers怎麽用?Golang FakeServiceBrokerRepo.ServiceBrokers使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cloudfoundry/cli/cf/api/fakes.FakeServiceBrokerRepo
的用法示例。
在下文中一共展示了FakeServiceBrokerRepo.ServiceBrokers方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
requirementsFactory.LoginSuccess = true
Expect(testcmd.RunCliCommand("service-brokers", []string{"blahblah"}, requirementsFactory, updateCommandDependency, false)).To(BeFalse())
Expect(ui.Outputs).To(ContainSubstrings(
[]string{"Incorrect Usage", "No argument"},
))
})
})
It("lists service brokers", func() {
repo.ServiceBrokers = []models.ServiceBroker{models.ServiceBroker{
Name: "service-broker-to-list-a",
Guid: "service-broker-to-list-guid-a",
Url: "http://service-a-url.com",
}, models.ServiceBroker{
Name: "service-broker-to-list-b",
Guid: "service-broker-to-list-guid-b",
Url: "http://service-b-url.com",
}, models.ServiceBroker{
Name: "service-broker-to-list-c",
Guid: "service-broker-to-list-guid-c",
Url: "http://service-c-url.com",
}}
testcmd.RunCliCommand("service-brokers", []string{}, requirementsFactory, updateCommandDependency, false)
Expect(ui.Outputs).To(ContainSubstrings(
[]string{"Getting service brokers as", "my-user"},
[]string{"name", "url"},
[]string{"service-broker-to-list-a", "http://service-a-url.com"},
[]string{"service-broker-to-list-b", "http://service-b-url.com"},
[]string{"service-broker-to-list-c", "http://service-c-url.com"},
示例2:
BeforeEach(func() {
brokerRepo = &fakes.FakeServiceBrokerRepo{}
serviceRepo = &fakes.FakeServiceRepo{}
servicePlanRepo = &fakes.FakeServicePlanRepo{}
servicePlanVisibilityRepo = &fakes.FakeServicePlanVisibilityRepository{}
orgRepo = &fakes.FakeOrgRepository{}
actor = actors.NewServiceHandler(brokerRepo, serviceRepo, servicePlanRepo, servicePlanVisibilityRepo, orgRepo)
serviceBroker1 := models.ServiceBroker{Guid: "my-service-broker-guid", Name: "my-service-broker"}
serviceBroker2 := models.ServiceBroker{Guid: "my-service-broker-guid2", Name: "my-service-broker2"}
brokerRepo.FindByNameServiceBroker = serviceBroker2
brokerRepo.ServiceBrokers = []models.ServiceBroker{
serviceBroker1,
serviceBroker2,
}
serviceRepo.ListServicesFromBrokerReturns = map[string][]models.ServiceOffering{
"my-service-broker-guid": {},
"my-service-broker-guid2": {
{ServiceOfferingFields: models.ServiceOfferingFields{Guid: "service-guid", Label: "my-service"}},
{ServiceOfferingFields: models.ServiceOfferingFields{Guid: "service-guid2", Label: "my-service2"}},
},
}
service2 := models.ServiceOffering{ServiceOfferingFields: models.ServiceOfferingFields{Label: "my-service2", Guid: "service-guid2"}}
serviceRepo.FindServiceOfferingByLabelServiceOffering = service2
servicePlanRepo.SearchReturns = map[string][]models.ServicePlanFields{
示例3:
BeforeEach(func() {
brokerRepo = &fakes.FakeServiceBrokerRepo{}
serviceRepo = &fakes.FakeServiceRepo{}
servicePlanRepo = &fakes.FakeServicePlanRepo{}
servicePlanVisibilityRepo = &fakes.FakeServicePlanVisibilityRepository{}
orgRepo = &fakes.FakeOrgRepository{}
actor = actors.NewServiceHandler(brokerRepo, serviceRepo, servicePlanRepo, servicePlanVisibilityRepo, orgRepo)
})
Describe("Get Brokers with Dependencies", func() {
Describe("Populates Dependencies", func() {
BeforeEach(func() {
brokerRepo.ServiceBrokers = []models.ServiceBroker{
{Guid: "my-service-broker-guid", Name: "my-service-broker"},
{Guid: "my-service-broker-guid2", Name: "my-service-broker2"},
}
serviceRepo.ListServicesFromBrokerReturns = map[string][]models.ServiceOffering{
"my-service-broker-guid": {},
"my-service-broker-guid2": {
{ServiceOfferingFields: models.ServiceOfferingFields{Guid: "service-guid", Label: "my-service"}},
{ServiceOfferingFields: models.ServiceOfferingFields{Guid: "service-guid2", Label: "my-service2"}},
},
}
servicePlanRepo.SearchReturns = map[string][]models.ServicePlanFields{
"service-guid": {{Name: "service-plan", Guid: "service-plan-guid"}, {Name: "other-plan", Guid: "other-plan-guid"}},
"service-guid2": {{Name: "service-plan2", Guid: "service-plan2-guid"}},
}