本文整理汇总了Golang中github.com/cloudfoundry/cli/cf/terminal/terminalfakes.FakeUI类的典型用法代码示例。如果您正苦于以下问题:Golang FakeUI类的具体用法?Golang FakeUI怎么用?Golang FakeUI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FakeUI类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
"github.com/cloudfoundry/cli/cf/commandregistry"
"github.com/cloudfoundry/cli/cf/terminal/terminalfakes"
"github.com/cloudfoundry/cli/cf/trace/tracefakes"
. "github.com/cloudfoundry/cli/plugin/rpc"
. "github.com/cloudfoundry/cli/plugin/rpc/fakecommand"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("calling commands in commandregistry", func() {
_ = FakeCommand1{} //make sure fake_command is imported and self-registered with init()
var (
ui *terminalfakes.FakeUI
deps commandregistry.Dependency
fakeLogger *tracefakes.FakePrinter
)
BeforeEach(func() {
fakeLogger = new(tracefakes.FakePrinter)
deps = commandregistry.NewDependency(os.Stdout, fakeLogger)
ui = new(terminalfakes.FakeUI)
deps.UI = ui
cmd := commandregistry.Commands.FindCommand("fake-command")
commandregistry.Commands.SetCommand(cmd.SetDependency(deps, true))
cmd2 := commandregistry.Commands.FindCommand("fake-command2")
commandregistry.Commands.SetCommand(cmd2.SetDependency(deps, true))
})
示例2:
"github.com/cloudfoundry/cli/cf/terminal/terminalfakes"
"github.com/cloudfoundry/cli/flags"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
)
var _ = Describe("Help", func() {
commandsloader.Load()
var (
fakeFactory *testreq.FakeReqFactory
fakeUI *terminalfakes.FakeUI
fakeConfig *pluginconfigfakes.FakePluginConfiguration
deps commandregistry.Dependency
cmd *commands.Help
flagContext flags.FlagContext
buffer *gbytes.Buffer
)
BeforeEach(func() {
buffer = gbytes.NewBuffer()
fakeUI = new(terminalfakes.FakeUI)
fakeUI.WriterReturns(buffer)
fakeConfig = new(pluginconfigfakes.FakePluginConfiguration)
deps = commandregistry.Dependency{
UI: fakeUI,
PluginConfig: fakeConfig,
示例3:
"github.com/cloudfoundry/cli/cf/errors/errorsfakes"
"github.com/cloudfoundry/cli/cf/api/apifakes"
cferrors "github.com/cloudfoundry/cli/cf/errors"
"github.com/cloudfoundry/cli/cf/models"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/cloudfoundry/cli/cf/terminal/terminalfakes"
)
var _ = Describe("Routes", func() {
var (
fakeUI *terminalfakes.FakeUI
fakeRouteRepository *apifakes.FakeRouteRepository
routeActor RouteActor
expectedRoute models.Route
expectedDomain models.DomainFields
)
BeforeEach(func() {
fakeUI = &terminalfakes.FakeUI{}
fakeRouteRepository = new(apifakes.FakeRouteRepository)
routeActor = NewRouteActor(fakeUI, fakeRouteRepository)
})
Describe("CreateRandomTCPRoute", func() {
BeforeEach(func() {
expectedDomain = models.DomainFields{
Name: "dies-tcp.com",
}
示例4:
package net_test
import (
"os"
"github.com/cloudfoundry/cli/cf/net"
"github.com/cloudfoundry/cli/cf/net/netfakes"
"github.com/cloudfoundry/cli/cf/terminal/terminalfakes"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("WarningsCollector", func() {
var (
ui *terminalfakes.FakeUI
oldRaiseErrorValue string
warningsCollector net.WarningsCollector
)
BeforeEach(func() {
ui = new(terminalfakes.FakeUI)
})
Describe("PrintWarnings", func() {
BeforeEach(func() {
oldRaiseErrorValue = os.Getenv("CF_RAISE_ERROR_ON_WARNINGS")
})
AfterEach(func() {
os.Setenv("CF_RAISE_ERROR_ON_WARNINGS", oldRaiseErrorValue)
})
示例5:
package panicprinter_test
import (
"github.com/cloudfoundry/cli/cf/errors"
. "github.com/cloudfoundry/cli/cf/panicprinter"
"github.com/cloudfoundry/cli/cf/terminal/terminalfakes"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Panic Printer", func() {
var (
ui *terminalfakes.FakeUI
panicPrinter PanicPrinter
)
BeforeEach(func() {
ui = new(terminalfakes.FakeUI)
panicPrinter = NewPanicPrinter(ui)
})
Describe("DisplayCrashDialog", func() {
It("includes the error message when given an error", func() {
panicPrinter.DisplayCrashDialog(errors.New("some-error"), "some command", "some trace")
Expect(ui.SayCallCount()).To(Equal(1))
Expect(ui.SayArgsForCall(0)).To(Equal(CrashDialog("some-error", "some command", "some trace")))
})
It("includes the string when given a string that is not terminal.QuietPanic", func() {
panicPrinter.DisplayCrashDialog("some-error", "some command", "some trace")
示例6:
"errors"
. "github.com/cloudfoundry/cli/cf/actors"
"github.com/cloudfoundry/cli/cf/api/apifakes"
"github.com/cloudfoundry/cli/cf/models"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/cloudfoundry/cli/cf/terminal/terminalfakes"
)
var _ = Describe("Routes", func() {
var (
fakeUI *terminalfakes.FakeUI
fakeRouteRepository *apifakes.FakeRouteRepository
routeActor RouteActor
)
BeforeEach(func() {
fakeUI = &terminalfakes.FakeUI{}
fakeRouteRepository = new(apifakes.FakeRouteRepository)
routeActor = NewRouteActor(fakeUI, fakeRouteRepository)
})
Describe("creating a random TCP route", func() {
var (
domain models.DomainFields
route models.Route
)