本文整理汇总了Golang中testhelpers/api.FakeServiceRepo.FindInstanceByNameMap方法的典型用法代码示例。如果您正苦于以下问题:Golang FakeServiceRepo.FindInstanceByNameMap方法的具体用法?Golang FakeServiceRepo.FindInstanceByNameMap怎么用?Golang FakeServiceRepo.FindInstanceByNameMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类testhelpers/api.FakeServiceRepo
的用法示例。
在下文中一共展示了FakeServiceRepo.FindInstanceByNameMap方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
It("fails when given the name of an app that is not in the manifest", func() {
callPush("non-existant-app")
testassert.SliceContains(ui.Outputs, testassert.Lines{
{"Failed"},
})
Expect(len(appRepo.CreateAppParams)).To(Equal(0))
})
})
It("binds service instances to the app", func() {
appRepo.ReadNotFound = true
serviceRepo.FindInstanceByNameMap = generic.NewMap(map[interface{}]interface{}{
"global-service": maker.NewServiceInstance("global-service"),
"app1-service": maker.NewServiceInstance("app1-service"),
"app2-service": maker.NewServiceInstance("app2-service"),
})
manifestRepo.ReadManifestReturns.Manifest = manifestWithServicesAndEnv()
callPush()
Expect(len(binder.AppsToBind)).To(Equal(4))
Expect(binder.AppsToBind[0].Name).To(Equal("app1"))
Expect(binder.AppsToBind[1].Name).To(Equal("app1"))
Expect(binder.InstancesToBindTo[0].Name).To(Equal("app1-service"))
Expect(binder.InstancesToBindTo[1].Name).To(Equal("global-service"))
Expect(binder.AppsToBind[2].Name).To(Equal("app2"))
Expect(binder.AppsToBind[3].Name).To(Equal("app2"))
Expect(binder.InstancesToBindTo[2].Name).To(Equal("app2-service"))