本文整理汇总了Golang中code/cloudfoundry/org/cli/commands/commandsfakes.FakeConfig类的典型用法代码示例。如果您正苦于以下问题:Golang FakeConfig类的具体用法?Golang FakeConfig怎么用?Golang FakeConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FakeConfig类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
package common_test
import (
"code.cloudfoundry.org/cli/commands/commandsfakes"
. "code.cloudfoundry.org/cli/commands/v2/common"
"code.cloudfoundry.org/cli/utils/configv3"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
)
var _ = Describe("CheckTarget", func() {
var (
binaryName string
fakeConfig *commandsfakes.FakeConfig
)
BeforeEach(func() {
binaryName = "faceman"
fakeConfig = new(commandsfakes.FakeConfig)
fakeConfig.BinaryNameReturns(binaryName)
})
Context("when the api endpoint is not set", func() {
It("returns an error", func() {
err := CheckTarget(fakeConfig, false, false)
Expect(err).To(MatchError(NoAPISetError{
BinaryName: binaryName,
}))
})
示例2:
. "code.cloudfoundry.org/cli/commands/v2"
"code.cloudfoundry.org/cli/commands/v2/common"
"code.cloudfoundry.org/cli/commands/v2/v2fakes"
"code.cloudfoundry.org/cli/utils/configv3"
"code.cloudfoundry.org/cli/utils/ui"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gbytes"
)
var _ = Describe("API Command", func() {
var (
cmd ApiCommand
fakeUI *ui.UI
fakeActor *v2fakes.FakeAPIConfigActor
fakeConfig *commandsfakes.FakeConfig
err error
)
BeforeEach(func() {
out := NewBuffer()
fakeUI = ui.NewTestUI(nil, out, out)
fakeActor = new(v2fakes.FakeAPIConfigActor)
fakeConfig = new(commandsfakes.FakeConfig)
fakeConfig.ExperimentalReturns(true)
cmd = ApiCommand{
UI: fakeUI,
Actor: fakeActor,
Config: fakeConfig,
示例3:
. "code.cloudfoundry.org/cli/commands/v2"
"code.cloudfoundry.org/cli/commands/v2/common"
"code.cloudfoundry.org/cli/commands/v2/v2fakes"
"code.cloudfoundry.org/cli/utils/configv3"
"code.cloudfoundry.org/cli/utils/ui"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gbytes"
)
var _ = Describe("Unbind Service Command", func() {
var (
cmd UnbindServiceCommand
fakeUI *ui.UI
fakeActor *v2fakes.FakeUnbindServiceActor
fakeConfig *commandsfakes.FakeConfig
executeErr error
)
BeforeEach(func() {
out := NewBuffer()
fakeUI = ui.NewTestUI(nil, out, out)
fakeActor = new(v2fakes.FakeUnbindServiceActor)
fakeConfig = new(commandsfakes.FakeConfig)
fakeConfig.ExperimentalReturns(true)
cmd = UnbindServiceCommand{
UI: fakeUI,
Actor: fakeActor,
Config: fakeConfig,
示例4:
"code.cloudfoundry.org/cli/commands/commandsfakes"
"code.cloudfoundry.org/cli/commands/flags"
. "code.cloudfoundry.org/cli/commands/v2"
"code.cloudfoundry.org/cli/commands/v2/v2fakes"
"code.cloudfoundry.org/cli/utils/configv3"
"code.cloudfoundry.org/cli/utils/ui"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gbytes"
)
var _ = Describe("Help Command", func() {
var (
fakeUI *ui.UI
fakeActor *v2fakes.FakeHelpActor
cmd HelpCommand
fakeConfig *commandsfakes.FakeConfig
)
BeforeEach(func() {
fakeUI = ui.NewTestUI(NewBuffer(), NewBuffer())
fakeActor = new(v2fakes.FakeHelpActor)
fakeConfig = new(commandsfakes.FakeConfig)
fakeConfig.BinaryNameReturns("faceman")
cmd = HelpCommand{
UI: fakeUI,
Actor: fakeActor,
Config: fakeConfig,
}
})
示例5:
package common_test
import (
"code.cloudfoundry.org/cli/commands/commandsfakes"
. "code.cloudfoundry.org/cli/commands/v2/common"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("New Cloud Controller Client", func() {
var (
binaryName string
fakeConfig *commandsfakes.FakeConfig
)
BeforeEach(func() {
binaryName = "faceman"
fakeConfig = new(commandsfakes.FakeConfig)
fakeConfig.BinaryNameReturns(binaryName)
})
Context("when the api endpoint is not set", func() {
It("returns an error", func() {
_, err := NewCloudControllerClient(fakeConfig)
Expect(err).To(MatchError(NoAPISetError{
BinaryName: binaryName,
}))
})
})
})