"github.com/cloudfoundry/cli/cf/models" "github.com/cloudfoundry/cli/cf/requirements" testApplication "github.com/cloudfoundry/cli/cf/api/applications/fakes" testterm "github.com/cloudfoundry/cli/testhelpers/terminal" . "github.com/cloudfoundry/cli/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("DeaApplication", func() { var ( req requirements.DEAApplicationRequirement ui *testterm.FakeUI appRepo *testApplication.FakeApplicationRepository appName string ) BeforeEach(func() { appName = "fake-app-name" ui = &testterm.FakeUI{} appRepo = &testApplication.FakeApplicationRepository{} req = requirements.NewDEAApplicationRequirement(appName, ui, appRepo) }) Describe("GetApplication", func() { It("returns an empty application", func() { Expect(req.GetApplication()).To(Equal(models.Application{})) })
. "github.com/cloudfoundry/cli/testhelpers/matchers" ) var _ = Describe("Push Command", func() { var ( ui *testterm.FakeUI configRepo core_config.Repository manifestRepo *testmanifest.FakeManifestRepository starter *appCmdFakes.FakeApplicationStarter stopper *appCmdFakes.FakeApplicationStopper serviceBinder *serviceCmdFakes.FakeAppBinder appRepo *testApplication.FakeApplicationRepository domainRepo *testapi.FakeDomainRepository routeRepo *testapi.FakeRouteRepository stackRepo *testStacks.FakeStackRepository serviceRepo *testapi.FakeServiceRepo wordGenerator *testwords.FakeWordGenerator requirementsFactory *testreq.FakeReqFactory authRepo *testapi.FakeAuthenticationRepository actor *fakeactors.FakePushActor app_files *fakeappfiles.FakeAppFiles zipper *fakeappfiles.FakeZipper OriginalCommandStart command_registry.Command OriginalCommandStop command_registry.Command OriginalCommandServiceBind command_registry.Command deps command_registry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.Ui = ui deps.Config = configRepo
"github.com/cloudfoundry/cli/cf/configuration/core_config" "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 core_config.ReadWriter requirementsFactory *testreq.FakeReqFactory authRepo *testapi.FakeAuthenticationRepository appRepo *testApplication.FakeApplicationRepository copyAppSourceRepo *testCopyApplication.FakeCopyApplicationSourceRepository spaceRepo *testapi.FakeSpaceRepository orgRepo *testorg.FakeOrganizationRepository appRestarter *testcmd.FakeApplicationRestarter ) BeforeEach(func() { ui = &testterm.FakeUI{} requirementsFactory = &testreq.FakeReqFactory{LoginSuccess: true, TargetedSpaceSuccess: true} authRepo = &testapi.FakeAuthenticationRepository{} appRepo = &testApplication.FakeApplicationRepository{} copyAppSourceRepo = &testCopyApplication.FakeCopyApplicationSourceRepository{} spaceRepo = &testapi.FakeSpaceRepository{} orgRepo = &testorg.FakeOrganizationRepository{} appRestarter = &testcmd.FakeApplicationRestarter{}
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/cf/commands/application" . "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 *testApplication.FakeApplicationRepository configRepo core_config.ReadWriter requirementsFactory *testreq.FakeReqFactory ) BeforeEach(func() { ui = &testterm.FakeUI{} app = models.Application{} app.Name = "my-app" appRepo = &testApplication.FakeApplicationRepository{} appRepo.ReadReturns.App = app configRepo = testconfig.NewRepositoryWithDefaults() requirementsFactory = &testreq.FakeReqFactory{LoginSuccess: true, TargetedSpaceSuccess: true} })
"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 core_config.Repository app models.Application appRepo *testApplication.FakeApplicationRepository requirementsFactory *testreq.FakeReqFactory deps command_registry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.Ui = ui deps.Config = configRepo deps.RepoLocator = deps.RepoLocator.SetApplicationRepository(appRepo) command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("set-env").SetDependency(deps, pluginCall)) } BeforeEach(func() { ui = &testterm.FakeUI{} app = models.Application{} app.Name = "my-app"
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 *testcmd.FakeApplicationRestarter appRepo *testApplication.FakeApplicationRepository ui *testterm.FakeUI config core_config.ReadWriter cmd *Scale app models.Application ) BeforeEach(func() { requirementsFactory = &testreq.FakeReqFactory{LoginSuccess: true, TargetedSpaceSuccess: true} restarter = &testcmd.FakeApplicationRestarter{} appRepo = &testApplication.FakeApplicationRepository{} ui = new(testterm.FakeUI) config = testconfig.NewRepositoryWithDefaults() cmd = NewScale(ui, config, restarter, appRepo) }) Describe("requirements", 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 *testcmd.FakeApplicationRestarter appRepo *testApplication.FakeApplicationRepository ui *testterm.FakeUI config core_config.Repository app models.Application OriginalCommand command_registry.Command deps command_registry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.Ui = ui deps.RepoLocator = deps.RepoLocator.SetApplicationRepository(appRepo) deps.Config = config //inject fake 'command dependency' into registry command_registry.Register(restarter) command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("scale").SetDependency(deps, pluginCall)) }
. "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/cloudfoundry/cli/testhelpers/matchers" ) var _ = Describe("start command", func() { var ( ui *testterm.FakeUI configRepo core_config.Repository defaultAppForStart = models.Application{} defaultInstanceResponses = [][]models.AppInstanceFields{} defaultInstanceErrorCodes = []string{"", ""} requirementsFactory *testreq.FakeReqFactory logsForTail []*events.LogMessage logRepo *testapi.FakeLogsNoaaRepository oldLogsForTail []*logmessage.LogMessage oldLogsRepo *testapi.FakeOldLogsRepository appInstancesRepo *testAppInstanaces.FakeAppInstancesRepository appRepo *testApplication.FakeApplicationRepository OriginalAppCommand command_registry.Command deps command_registry.Dependency displayApp *testcmd.FakeAppDisplayer ) updateCommandDependency := func(oldLogs api.OldLogsRepository) { deps.Ui = ui deps.Config = configRepo deps.RepoLocator = deps.RepoLocator.SetLogsNoaaRepository(logRepo) deps.RepoLocator = deps.RepoLocator.SetOldLogsRepository(oldLogs) deps.RepoLocator = deps.RepoLocator.SetApplicationRepository(appRepo)
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 core_config.Repository appRepo *testApplication.FakeApplicationRepository routeRepo *testapi.FakeRouteRepository requirementsFactory *testreq.FakeReqFactory deps command_registry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.Ui = ui deps.Config = configRepo deps.RepoLocator = deps.RepoLocator.SetApplicationRepository(appRepo) deps.RepoLocator = deps.RepoLocator.SetRouteRepository(routeRepo) command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("delete").SetDependency(deps, pluginCall)) } BeforeEach(func() { app = models.Application{}
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/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 *testApplication.FakeApplicationRepository requirementsFactory *testreq.FakeReqFactory config core_config.ReadWriter ) BeforeEach(func() { ui = &testterm.FakeUI{} config = testconfig.NewRepositoryWithDefaults() appRepo = &testApplication.FakeApplicationRepository{} requirementsFactory = &testreq.FakeReqFactory{} }) runCommand := func(args ...string) bool { return testcmd.RunCommand(NewStop(ui, config, appRepo), args, requirementsFactory) }
package requirements_test import ( testApplication "github.com/cloudfoundry/cli/cf/api/applications/fakes" "github.com/cloudfoundry/cli/cf/errors" "github.com/cloudfoundry/cli/cf/models" . "github.com/cloudfoundry/cli/cf/requirements" testassert "github.com/cloudfoundry/cli/testhelpers/assert" testterm "github.com/cloudfoundry/cli/testhelpers/terminal" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("ApplicationRequirement", func() { var ui *testterm.FakeUI var appRepo *testApplication.FakeApplicationRepository BeforeEach(func() { ui = new(testterm.FakeUI) appRepo = &testApplication.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", ui, appRepo) Expect(appReq.Execute()).To(BeTrue())
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/command_registry" "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 *testApplication.FakeApplicationRepository requirementsFactory *testreq.FakeReqFactory config core_config.Repository deps command_registry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.Ui = ui deps.RepoLocator = deps.RepoLocator.SetApplicationRepository(appRepo) deps.Config = config command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("stop").SetDependency(deps, pluginCall)) } BeforeEach(func() { ui = &testterm.FakeUI{} config = testconfig.NewRepositoryWithDefaults() appRepo = &testApplication.FakeApplicationRepository{}
"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 core_config.Repository requirementsFactory *testreq.FakeReqFactory authRepo *testapi.FakeAuthenticationRepository appRepo *testApplication.FakeApplicationRepository copyAppSourceRepo *testCopyApplication.FakeCopyApplicationSourceRepository spaceRepo *testapi.FakeSpaceRepository orgRepo *testorg.FakeOrganizationRepository appRestarter *testcmd.FakeApplicationRestarter OriginalCommand command_registry.Command deps command_registry.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
. "github.com/cloudfoundry/cli/testhelpers/matchers" ) var _ = Describe("Push Command", func() { var ( ui *testterm.FakeUI configRepo core_config.Repository manifestRepo *testmanifest.FakeManifestRepository starter *testcmd.FakeApplicationStarter stopper *testcmd.FakeApplicationStopper serviceBinder *testcmd.FakeAppBinder appRepo *testApplication.FakeApplicationRepository domainRepo *testapi.FakeDomainRepository routeRepo *testapi.FakeRouteRepository stackRepo *testStacks.FakeStackRepository serviceRepo *testapi.FakeServiceRepo wordGenerator *testwords.FakeWordGenerator requirementsFactory *testreq.FakeReqFactory authRepo *testapi.FakeAuthenticationRepository actor *fakeactors.FakePushActor app_files *fakeappfiles.FakeAppFiles zipper *fakeappfiles.FakeZipper OriginalCommandStart command_registry.Command OriginalCommandStop command_registry.Command OriginalCommandServiceBind command_registry.Command deps command_registry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.Ui = ui deps.Config = configRepo
"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("disable-ssh command", func() { var ( ui *testterm.FakeUI requirementsFactory *testreq.FakeReqFactory appRepo *testApplication.FakeApplicationRepository configRepo core_config.Repository deps command_registry.Dependency ) BeforeEach(func() { ui = &testterm.FakeUI{} configRepo = testconfig.NewRepositoryWithDefaults() requirementsFactory = &testreq.FakeReqFactory{} appRepo = &testApplication.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("enable-ssh command", func() { var ( ui *testterm.FakeUI requirementsFactory *testreq.FakeReqFactory appRepo *testApplication.FakeApplicationRepository configRepo core_config.Repository deps command_registry.Dependency ) BeforeEach(func() { ui = &testterm.FakeUI{} configRepo = testconfig.NewRepositoryWithDefaults() requirementsFactory = &testreq.FakeReqFactory{} appRepo = &testApplication.FakeApplicationRepository{} }) updateCommandDependency := func(pluginCall bool) { deps.Ui = ui deps.Config = configRepo deps.RepoLocator = deps.RepoLocator.SetApplicationRepository(appRepo)
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/cf/commands/application" . "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 core_config.ReadWriter app models.Application appRepo *testApplication.FakeApplicationRepository requirementsFactory *testreq.FakeReqFactory ) BeforeEach(func() { ui = &testterm.FakeUI{} app = models.Application{} app.Name = "my-app" app.Guid = "my-app-guid" appRepo = &testApplication.FakeApplicationRepository{} requirementsFactory = &testreq.FakeReqFactory{} configRepo = testconfig.NewRepositoryWithDefaults() }) runCommand := func(args ...string) bool {
. "github.com/onsi/gomega" . "github.com/cloudfoundry/cli/testhelpers/matchers" ) var _ = Describe("Push Command", func() { var ( cmd *Push ui *testterm.FakeUI configRepo core_config.ReadWriter manifestRepo *testmanifest.FakeManifestRepository starter *testcmd.FakeApplicationStarter stopper *testcmd.FakeApplicationStopper serviceBinder *testcmd.FakeAppBinder appRepo *testApplication.FakeApplicationRepository domainRepo *testapi.FakeDomainRepository routeRepo *testapi.FakeRouteRepository stackRepo *testStacks.FakeStackRepository serviceRepo *testapi.FakeServiceRepo wordGenerator *testwords.FakeWordGenerator requirementsFactory *testreq.FakeReqFactory authRepo *testapi.FakeAuthenticationRepository actor *fakeactors.FakePushActor app_files *fakeappfiles.FakeAppFiles zipper *fakeappfiles.FakeZipper ) BeforeEach(func() { manifestRepo = &testmanifest.FakeManifestRepository{} starter = &testcmd.FakeApplicationStarter{} stopper = &testcmd.FakeApplicationStopper{} serviceBinder = &testcmd.FakeAppBinder{}
. "github.com/cloudfoundry/cli/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("start command", func() { var ( ui *testterm.FakeUI configRepo core_config.Repository defaultAppForStart models.Application defaultInstanceResponses [][]models.AppInstanceFields defaultInstanceErrorCodes []string requirementsFactory *testreq.FakeReqFactory logMessages []*logmessage.LogMessage logRepo *testapi.FakeLogsRepository appInstancesRepo *testAppInstanaces.FakeAppInstancesRepository appRepo *testApplication.FakeApplicationRepository OriginalAppCommand command_registry.Command deps command_registry.Dependency displayApp *appCmdFakes.FakeAppDisplayer ) updateCommandDependency := func(logsRepo api.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/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 core_config.Repository appRepo *testApplication.FakeApplicationRepository deps command_registry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.Ui = ui deps.Config = configRepo deps.RepoLocator = deps.RepoLocator.SetApplicationRepository(appRepo) command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("rename").SetDependency(deps, pluginCall)) } BeforeEach(func() { ui = &testterm.FakeUI{} configRepo = testconfig.NewRepositoryWithDefaults() requirementsFactory = &testreq.FakeReqFactory{}