本文整理匯總了Golang中github.com/cloudfoundry/cli/cf/api/applications/applicationsfakes.FakeRepository類的典型用法代碼示例。如果您正苦於以下問題:Golang FakeRepository類的具體用法?Golang FakeRepository怎麽用?Golang FakeRepository使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了FakeRepository類的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
deps commandregistry.Dependency
flagContext flags.FlagContext
reqFactory *requirementsfakes.FakeFactory
loginRequirement requirements.Requirement
targetedSpaceRequirement requirements.Requirement
serviceInstanceRequirement *requirementsfakes.FakeServiceInstanceRequirement
pluginCall bool
cmd *service.ShowService
)
BeforeEach(func() {
ui = &testterm.FakeUI{}
pluginCall = false
appRepo := new(applicationsfakes.FakeRepository)
appRepo.GetAppStub = func(appGUID string) (models.Application, error) {
if appGUID == "app1-guid" {
return models.Application{
ApplicationFields: models.ApplicationFields{
Name: "app1",
},
}, nil
}
return models.Application{}, fmt.Errorf("Called stubbed applications repo GetApp with incorrect app GUID\nExpected \"app1-guid\"\nGot \"%s\"\n", appGUID)
}
deps = commandregistry.Dependency{
UI: ui,
PluginModels: &commandregistry.PluginModels{},
RepoLocator: api.RepositoryLocator{}.SetApplicationRepository(appRepo),
示例2:
"github.com/cloudfoundry/cli/cf/requirements"
"github.com/cloudfoundry/cli/cf/requirements/requirementsfakes"
testcmd "github.com/cloudfoundry/cli/testhelpers/commands"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("set-health-check command", func() {
var (
ui *testterm.FakeUI
requirementsFactory *requirementsfakes.FakeFactory
appRepo *applicationsfakes.FakeRepository
configRepo coreconfig.Repository
deps commandregistry.Dependency
)
BeforeEach(func() {
ui = &testterm.FakeUI{}
configRepo = testconfig.NewRepositoryWithDefaults()
requirementsFactory = new(requirementsfakes.FakeFactory)
appRepo = new(applicationsfakes.FakeRepository)
})
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.Config = configRepo
deps.RepoLocator = deps.RepoLocator.SetApplicationRepository(appRepo)
示例3:
testcmd "github.com/cloudfoundry/cli/testhelpers/commands"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
"github.com/cloudfoundry/cli/cf/commandregistry"
"github.com/cloudfoundry/cli/cf/commands/application"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("stop command", func() {
var (
ui *testterm.FakeUI
app models.Application
appRepo *applicationsfakes.FakeRepository
requirementsFactory *requirementsfakes.FakeFactory
config coreconfig.Repository
deps commandregistry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.RepoLocator = deps.RepoLocator.SetApplicationRepository(appRepo)
deps.Config = config
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("stop").SetDependency(deps, pluginCall))
}
BeforeEach(func() {
ui = &testterm.FakeUI{}
config = testconfig.NewRepositoryWithDefaults()
appRepo = new(applicationsfakes.FakeRepository)
示例4:
"github.com/cloudfoundry/cli/cf/errors"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("CopySource", func() {
var (
ui *testterm.FakeUI
config coreconfig.Repository
requirementsFactory *requirementsfakes.FakeFactory
authRepo *authenticationfakes.FakeRepository
appRepo *applicationsfakes.FakeRepository
copyAppSourceRepo *copyapplicationsourcefakes.FakeRepository
spaceRepo *spacesfakes.FakeSpaceRepository
orgRepo *organizationsfakes.FakeOrganizationRepository
appRestarter *applicationfakes.FakeRestarter
OriginalCommand commandregistry.Command
deps commandregistry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.RepoLocator = deps.RepoLocator.SetAuthenticationRepository(authRepo)
deps.RepoLocator = deps.RepoLocator.SetApplicationRepository(appRepo)
deps.RepoLocator = deps.RepoLocator.SetCopyApplicationSourceRepository(copyAppSourceRepo)
deps.RepoLocator = deps.RepoLocator.SetSpaceRepository(spaceRepo)
deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo)
deps.Config = config
示例5:
package requirements_test
import (
"github.com/cloudfoundry/cli/cf/api/applications/applicationsfakes"
"github.com/cloudfoundry/cli/cf/errors"
"github.com/cloudfoundry/cli/cf/models"
. "github.com/cloudfoundry/cli/cf/requirements"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("ApplicationRequirement", func() {
var appRepo *applicationsfakes.FakeRepository
BeforeEach(func() {
appRepo = new(applicationsfakes.FakeRepository)
})
It("succeeds when an app with the given name exists", func() {
app := models.Application{}
app.Name = "my-app"
app.GUID = "my-app-guid"
appRepo.ReadReturns(app, nil)
appReq := NewApplicationRequirement("foo", appRepo)
err := appReq.Execute()
Expect(err).NotTo(HaveOccurred())
Expect(appRepo.ReadArgsForCall(0)).To(Equal("foo"))
Expect(appReq.GetApplication()).To(Equal(app))
示例6:
"sync/atomic"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("start command", func() {
var (
ui *testterm.FakeUI
configRepo coreconfig.Repository
defaultAppForStart models.Application
defaultInstanceResponses [][]models.AppInstanceFields
defaultInstanceErrorCodes []string
requirementsFactory *requirementsfakes.FakeFactory
logMessages atomic.Value
logRepo *logsfakes.FakeRepository
appInstancesRepo *appinstancesfakes.FakeAppInstancesRepository
appRepo *applicationsfakes.FakeRepository
originalAppCommand commandregistry.Command
deps commandregistry.Dependency
displayApp *applicationfakes.FakeAppDisplayer
)
updateCommandDependency := func(logsRepo logs.Repository) {
deps.UI = ui
deps.Config = configRepo
deps.RepoLocator = deps.RepoLocator.SetLogsRepository(logsRepo)
deps.RepoLocator = deps.RepoLocator.SetApplicationRepository(appRepo)
deps.RepoLocator = deps.RepoLocator.SetAppInstancesRepository(appInstancesRepo)
示例7:
"github.com/cloudfoundry/cli/cf/requirements/requirementsfakes"
testcmd "github.com/cloudfoundry/cli/testhelpers/commands"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
)
var _ = Describe("delete app command", func() {
var (
ui *testterm.FakeUI
app models.Application
configRepo coreconfig.Repository
appRepo *applicationsfakes.FakeRepository
routeRepo *apifakes.FakeRouteRepository
requirementsFactory *requirementsfakes.FakeFactory
deps commandregistry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.Config = configRepo
deps.RepoLocator = deps.RepoLocator.SetApplicationRepository(appRepo)
deps.RepoLocator = deps.RepoLocator.SetRouteRepository(routeRepo)
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("delete").SetDependency(deps, pluginCall))
}
BeforeEach(func() {
app = models.Application{}
示例8:
import (
"errors"
"github.com/cloudfoundry/cli/cf/models"
"github.com/cloudfoundry/cli/cf/requirements"
"github.com/cloudfoundry/cli/cf/api/applications/applicationsfakes"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("DiegoApplication", func() {
var (
req requirements.DiegoApplicationRequirement
appRepo *applicationsfakes.FakeRepository
appName string
)
BeforeEach(func() {
appName = "fake-app-name"
appRepo = new(applicationsfakes.FakeRepository)
req = requirements.NewDiegoApplicationRequirement(appName, appRepo)
})
Describe("GetApplication", func() {
It("returns an empty application", func() {
Expect(req.GetApplication()).To(Equal(models.Application{}))
})
Context("when the requirement has been executed", func() {
示例9:
"github.com/cloudfoundry/cli/cf/requirements"
"github.com/cloudfoundry/cli/cf/requirements/requirementsfakes"
testcmd "github.com/cloudfoundry/cli/testhelpers/commands"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("env command", func() {
var (
ui *testterm.FakeUI
app models.Application
appRepo *applicationsfakes.FakeRepository
configRepo coreconfig.Repository
requirementsFactory *requirementsfakes.FakeFactory
deps commandregistry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.Config = configRepo
deps.RepoLocator = deps.RepoLocator.SetApplicationRepository(appRepo)
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("env").SetDependency(deps, pluginCall))
}
BeforeEach(func() {
ui = &testterm.FakeUI{}
app = models.Application{}
示例10:
"github.com/cloudfoundry/cli/cf/requirements/requirementsfakes"
testcmd "github.com/cloudfoundry/cli/testhelpers/commands"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
)
var _ = Describe("scale command", func() {
var (
requirementsFactory *requirementsfakes.FakeFactory
restarter *applicationfakes.FakeRestarter
appRepo *applicationsfakes.FakeRepository
ui *testterm.FakeUI
config coreconfig.Repository
app models.Application
OriginalCommand commandregistry.Command
deps commandregistry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.RepoLocator = deps.RepoLocator.SetApplicationRepository(appRepo)
deps.Config = config
//inject fake 'command dependency' into registry
commandregistry.Register(restarter)
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("scale").SetDependency(deps, pluginCall))
}
示例11:
"github.com/cloudfoundry/cli/cf/requirements"
"github.com/cloudfoundry/cli/cf/requirements/requirementsfakes"
testcmd "github.com/cloudfoundry/cli/testhelpers/commands"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Rename command", func() {
var (
ui *testterm.FakeUI
requirementsFactory *requirementsfakes.FakeFactory
configRepo coreconfig.Repository
appRepo *applicationsfakes.FakeRepository
deps commandregistry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.Config = configRepo
deps.RepoLocator = deps.RepoLocator.SetApplicationRepository(appRepo)
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("rename").SetDependency(deps, pluginCall))
}
BeforeEach(func() {
ui = &testterm.FakeUI{}
configRepo = testconfig.NewRepositoryWithDefaults()
requirementsFactory = new(requirementsfakes.FakeFactory)
示例12:
"github.com/cloudfoundry/cli/cf/requirements"
"github.com/cloudfoundry/cli/cf/requirements/requirementsfakes"
testcmd "github.com/cloudfoundry/cli/testhelpers/commands"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("set-env command", func() {
var (
ui *testterm.FakeUI
configRepo coreconfig.Repository
app models.Application
appRepo *applicationsfakes.FakeRepository
requirementsFactory *requirementsfakes.FakeFactory
deps commandregistry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.Config = configRepo
deps.RepoLocator = deps.RepoLocator.SetApplicationRepository(appRepo)
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("set-env").SetDependency(deps, pluginCall))
}
BeforeEach(func() {
ui = &testterm.FakeUI{}
app = models.Application{}
app.Name = "my-app"