本文整理汇总了Golang中github.com/cloudfoundry-incubator/ducati-daemon/fakes.Context.SandboxRepositoryReturns方法的典型用法代码示例。如果您正苦于以下问题:Golang Context.SandboxRepositoryReturns方法的具体用法?Golang Context.SandboxRepositoryReturns怎么用?Golang Context.SandboxRepositoryReturns使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry-incubator/ducati-daemon/fakes.Context
的用法示例。
在下文中一共展示了Context.SandboxRepositoryReturns方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
var (
context *fakes.Context
linkFactory *fakes.LinkFactory
sandboxRepository *fakes.SandboxRepository
sbox *fakes.Sandbox
moveLink commands.MoveLink
)
BeforeEach(func() {
context = &fakes.Context{}
linkFactory = &fakes.LinkFactory{}
context.LinkFactoryReturns(linkFactory)
sandboxRepository = &fakes.SandboxRepository{}
context.SandboxRepositoryReturns(sandboxRepository)
sbox = &fakes.Sandbox{}
sandboxRepository.GetReturns(sbox, nil)
ns := &fakes.Namespace{}
ns.FdReturns(999)
ns.NameReturns("target-namespace")
sbox.NamespaceReturns(ns)
moveLink = commands.MoveLink{
Name: "link-name",
SandboxName: "sandbox-name",
}
})
示例2:
"github.com/cloudfoundry-incubator/ducati-daemon/sandbox"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("SandboxExists", func() {
var (
repo *fakes.SandboxRepository
sandboxExists conditions.SandboxExists
context *fakes.Context
)
BeforeEach(func() {
repo = &fakes.SandboxRepository{}
context = &fakes.Context{}
context.SandboxRepositoryReturns(repo)
sandboxExists = conditions.SandboxExists{
Name: "some-sandbox",
}
})
Context("when the namespace exists", func() {
BeforeEach(func() {
repo.GetReturns(&fakes.Sandbox{}, nil)
})
It("returns true", func() {
satisfied, err := sandboxExists.Satisfied(context)
Expect(err).NotTo(HaveOccurred())
Expect(satisfied).To(BeTrue())