本文整理汇总了Golang中testhelpers/api.FakeServiceRepo.FindServicePlanByDescriptionResponses方法的典型用法代码示例。如果您正苦于以下问题:Golang FakeServiceRepo.FindServicePlanByDescriptionResponses方法的具体用法?Golang FakeServiceRepo.FindServicePlanByDescriptionResponses怎么用?Golang FakeServiceRepo.FindServicePlanByDescriptionResponses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类testhelpers/api.FakeServiceRepo
的用法示例。
在下文中一共展示了FakeServiceRepo.FindServicePlanByDescriptionResponses方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: init
//.........这里部分代码省略.........
expectedV1 := api.ServicePlanDescription{
ServicePlanName: "v1-plan-name",
ServiceProvider: "v1-provider-name",
ServiceName: "v1-service-name",
}
Expect(serviceRepo.FindServicePlanByDescriptionArguments[0]).To(Equal(expectedV1))
})
It("finds the v2 service plan by its name and service label", func() {
testcmd.RunCommand(cmd, context, requirementsFactory)
expectedV2 := api.ServicePlanDescription{
ServicePlanName: "v2-plan-name",
ServiceName: "v2-service-name",
}
Expect(serviceRepo.FindServicePlanByDescriptionArguments[1]).To(Equal(expectedV2))
})
It("notifies the user that the migration was successful", func() {
serviceRepo.ServiceInstanceCountForServicePlan = 2
testcmd.RunCommand(cmd, context, requirementsFactory)
testassert.SliceContains(ui.Outputs, testassert.Lines{
{"Attempting to migrate", "2", "service instances"},
{"1", "service instance", "migrated"},
{"OK"},
})
})
})
Context("when finding the v1 plan fails", func() {
Context("because the plan does not exist", func() {
BeforeEach(func() {
serviceRepo.FindServicePlanByDescriptionResponses = []net.ApiResponse{net.NewNotFoundApiResponse("not used")}
})
It("notifies the user of the failure", func() {
testcmd.RunCommand(cmd, context, requirementsFactory)
testassert.SliceContains(ui.Outputs, testassert.Lines{
{"FAILED"},
{"Plan", "v1-service-name", "v1-provider-name", "v1-plan-name", "cannot be found"},
})
})
It("does not display the warning", func() {
testcmd.RunCommand(cmd, context, requirementsFactory)
testassert.SliceDoesNotContain(ui.Outputs, testassert.Lines{
{"WARNING:", "this operation is to replace a service broker"},
})
})
})
Context("because there was an http error", func() {
BeforeEach(func() {
serviceRepo.FindServicePlanByDescriptionResponses = []net.ApiResponse{net.NewApiResponseWithMessage("uh oh")}
})
It("notifies the user of the failure", func() {
testcmd.RunCommand(cmd, context, requirementsFactory)
testassert.SliceContains(ui.Outputs, testassert.Lines{
{"FAILED"},
{"uh oh"},
})