コード例 #1
0
ファイル: dea_application_test.go プロジェクト: QwaQ/cli
	"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{}))
		})
コード例 #2
0
ファイル: push_test.go プロジェクト: EndruBoy/cli
	. "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
コード例 #3
0
	"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{}
コード例 #4
0
ファイル: env_test.go プロジェクト: tools-alexuser01/cli
	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}
	})
コード例 #5
0
ファイル: set_env_test.go プロジェクト: vframbach/cli
	"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"
コード例 #6
0
ファイル: scale_test.go プロジェクト: tools-alexuser01/cli
	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() {
コード例 #7
0
ファイル: scale_test.go プロジェクト: emc-xchallenge/cli
	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))
	}
コード例 #8
0
ファイル: start_test.go プロジェクト: ralfcam/cli
	. "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)
コード例 #9
0
ファイル: delete_test.go プロジェクト: vframbach/cli
	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{}
コード例 #10
0
ファイル: stop_test.go プロジェクト: tools-alexuser01/cli
	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)
	}
コード例 #11
0
ファイル: application_test.go プロジェクト: vframbach/cli
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())
コード例 #12
0
ファイル: stop_test.go プロジェクト: vframbach/cli
	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{}
コード例 #13
0
	"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
コード例 #14
0
ファイル: push_test.go プロジェクト: 0976254669/cli
	. "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
コード例 #15
0
ファイル: disable_ssh_test.go プロジェクト: vframbach/cli
	"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)
コード例 #16
0
ファイル: enable_ssh_test.go プロジェクト: 0976254669/cli
	"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)
コード例 #17
0
ファイル: set_env_test.go プロジェクト: tools-alexuser01/cli
	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 {
コード例 #18
0
ファイル: push_test.go プロジェクト: raghulsid/cli
	. "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{}
コード例 #19
0
ファイル: start_test.go プロジェクト: rbramwell/cli
	. "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)
コード例 #20
0
ファイル: rename_test.go プロジェクト: vframbach/cli
	"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{}