"github.com/cloudfoundry/cli/cf/models" testcmd "github.com/cloudfoundry/cli/testhelpers/commands" testconfig "github.com/cloudfoundry/cli/testhelpers/configuration" testreq "github.com/cloudfoundry/cli/testhelpers/requirements" testterm "github.com/cloudfoundry/cli/testhelpers/terminal" . "github.com/cloudfoundry/cli/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("enable-ssh command", func() { var ( ui *testterm.FakeUI requirementsFactory *testreq.FakeReqFactory appRepo *applicationsfakes.FakeApplicationRepository configRepo coreconfig.Repository deps commandregistry.Dependency ) BeforeEach(func() { ui = &testterm.FakeUI{} configRepo = testconfig.NewRepositoryWithDefaults() requirementsFactory = &testreq.FakeReqFactory{} appRepo = new(applicationsfakes.FakeApplicationRepository) }) updateCommandDependency := func(pluginCall bool) { deps.UI = ui deps.Config = configRepo deps.RepoLocator = deps.RepoLocator.SetApplicationRepository(appRepo)
"github.com/cloudfoundry/cli/cf/models" testcmd "github.com/cloudfoundry/cli/testhelpers/commands" testconfig "github.com/cloudfoundry/cli/testhelpers/configuration" testreq "github.com/cloudfoundry/cli/testhelpers/requirements" 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.FakeApplicationRepository requirementsFactory *testreq.FakeReqFactory 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"
"github.com/cloudfoundry/cli/cf/models" testcmd "github.com/cloudfoundry/cli/testhelpers/commands" testconfig "github.com/cloudfoundry/cli/testhelpers/configuration" testreq "github.com/cloudfoundry/cli/testhelpers/requirements" 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.FakeApplicationRepository configRepo coreconfig.Repository requirementsFactory *testreq.FakeReqFactory 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{}
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.FakeApplicationRepository appName string ) BeforeEach(func() { appName = "fake-app-name" appRepo = new(applicationsfakes.FakeApplicationRepository) 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() {
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration" "github.com/cloudfoundry/cli/testhelpers/maker" testreq "github.com/cloudfoundry/cli/testhelpers/requirements" 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 *testreq.FakeReqFactory restarter *applicationfakes.FakeApplicationRestarter appRepo *applicationsfakes.FakeApplicationRepository 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)) }
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.FakeApplicationRepository BeforeEach(func() { appRepo = new(applicationsfakes.FakeApplicationRepository) }) 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))
"sync" . "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 *testreq.FakeReqFactory logMessages []logs.Loggable logRepo *logsfakes.FakeLogsRepository appInstancesRepo *appinstancesfakes.FakeAppInstancesRepository appRepo *applicationsfakes.FakeApplicationRepository originalAppCommand commandregistry.Command deps commandregistry.Dependency displayApp *applicationfakes.FakeAppDisplayer ) updateCommandDependency := func(logsRepo logs.LogsRepository) { deps.UI = ui deps.Config = configRepo deps.RepoLocator = deps.RepoLocator.SetLogsRepository(logsRepo) deps.RepoLocator = deps.RepoLocator.SetApplicationRepository(appRepo) deps.RepoLocator = deps.RepoLocator.SetAppInstancesRepository(appInstancesRepo)
"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 *testreq.FakeReqFactory authRepo *authenticationfakes.FakeAuthenticationRepository appRepo *applicationsfakes.FakeApplicationRepository copyAppSourceRepo *copyapplicationsourcefakes.FakeCopyApplicationSourceRepository spaceRepo *apifakes.FakeSpaceRepository orgRepo *organizationsfakes.FakeOrganizationRepository appRestarter *applicationfakes.FakeApplicationRestarter 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
testcmd "github.com/cloudfoundry/cli/testhelpers/commands" testconfig "github.com/cloudfoundry/cli/testhelpers/configuration" testreq "github.com/cloudfoundry/cli/testhelpers/requirements" 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.FakeApplicationRepository routeRepo *apifakes.FakeRouteRepository requirementsFactory *testreq.FakeReqFactory 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{}
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration" testreq "github.com/cloudfoundry/cli/testhelpers/requirements" 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.FakeApplicationRepository requirementsFactory *testreq.FakeReqFactory 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.FakeApplicationRepository)
"github.com/cloudfoundry/cli/cf/models" testcmd "github.com/cloudfoundry/cli/testhelpers/commands" testconfig "github.com/cloudfoundry/cli/testhelpers/configuration" testreq "github.com/cloudfoundry/cli/testhelpers/requirements" 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 *testreq.FakeReqFactory configRepo coreconfig.Repository appRepo *applicationsfakes.FakeApplicationRepository 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 = &testreq.FakeReqFactory{}