) type passingRequirement struct{} func (r passingRequirement) Execute() bool { return true } var _ = Describe("CreateRoute", func() { var ( ui *testterm.FakeUI routeRepo *fakeapi.FakeRouteRepository configRepo core_config.Repository cmd route.CreateRoute deps command_registry.Dependency factory *fakerequirements.FakeFactory flagContext flags.FlagContext spaceRequirement *fakerequirements.FakeSpaceRequirement domainRequirement *fakerequirements.FakeDomainRequirement minAPIVersionRequirement requirements.Requirement ) BeforeEach(func() { ui = &testterm.FakeUI{} configRepo = testconfig.NewRepositoryWithDefaults() routeRepo = &fakeapi.FakeRouteRepository{} repoLocator := deps.RepoLocator.SetRouteRepository(routeRepo) deps = command_registry.Dependency{ Ui: ui,
. "github.com/onsi/gomega" . "github.com/cloudfoundry/cli/testhelpers/matchers" ) var _ = Describe("Push Command", func() { var ( cmd *Push ui *testterm.FakeUI configRepo configuration.ReadWriter manifestRepo *testmanifest.FakeManifestRepository starter *testcmd.FakeAppStarter stopper *testcmd.FakeAppStopper serviceBinder *testcmd.FakeAppBinder appRepo *testapi.FakeApplicationRepository domainRepo *testapi.FakeDomainRepository routeRepo *testapi.FakeRouteRepository stackRepo *testapi.FakeStackRepository serviceRepo *testapi.FakeServiceRepo wordGenerator words.WordGenerator requirementsFactory *testreq.FakeReqFactory authRepo *testapi.FakeAuthenticationRepository actor *fakeactors.FakePushActor app_files *fakeappfiles.FakeAppFiles zipper *fakeappfiles.FakeZipper ) BeforeEach(func() { manifestRepo = &testmanifest.FakeManifestRepository{} starter = &testcmd.FakeAppStarter{} stopper = &testcmd.FakeAppStopper{} serviceBinder = &testcmd.FakeAppBinder{}
"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/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/cloudfoundry/cli/testhelpers/matchers" ) var _ = Describe("routes command", func() { var ( ui *testterm.FakeUI routeRepo *testapi.FakeRouteRepository configRepo core_config.Repository requirementsFactory *testreq.FakeReqFactory deps command_registry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.Ui = ui deps.RepoLocator = deps.RepoLocator.SetRouteRepository(routeRepo) deps.Config = configRepo command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("routes").SetDependency(deps, pluginCall)) } BeforeEach(func() { ui = &testterm.FakeUI{} configRepo = testconfig.NewRepositoryWithDefaults() requirementsFactory = &testreq.FakeReqFactory{
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{}
. "github.com/cloudfoundry/cli/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("MapRoute", func() { var ( ui *testterm.FakeUI configRepo core_config.Repository routeRepo *fakeapi.FakeRouteRepository cmd command_registry.Command deps command_registry.Dependency factory *fakerequirements.FakeFactory flagContext flags.FlagContext loginRequirement requirements.Requirement applicationRequirement *fakerequirements.FakeApplicationRequirement domainRequirement *fakerequirements.FakeDomainRequirement minAPIVersionRequirement requirements.Requirement originalCreateRouteCmd command_registry.Command fakeCreateRouteCmd command_registry.Command fakeDomain models.DomainFields ) BeforeEach(func() { ui = &testterm.FakeUI{} configRepo = testconfig.NewRepositoryWithDefaults() routeRepo = &fakeapi.FakeRouteRepository{} repoLocator := deps.RepoLocator.SetRouteRepository(routeRepo)
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/configuration/core_config" . "github.com/cloudfoundry/cli/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("delete-orphaned-routes command", func() { var ( ui *testterm.FakeUI routeRepo *testapi.FakeRouteRepository configRepo core_config.Repository reqFactory *testreq.FakeReqFactory deps command_registry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.Ui = ui deps.RepoLocator = deps.RepoLocator.SetRouteRepository(routeRepo) deps.Config = configRepo command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("delete-orphaned-routes").SetDependency(deps, pluginCall)) } callDeleteOrphanedRoutes := func(confirmation string, args []string, reqFactory *testreq.FakeReqFactory, routeRepo *testapi.FakeRouteRepository) (*testterm.FakeUI, bool) { ui = &testterm.FakeUI{Inputs: []string{confirmation}} configRepo = testconfig.NewRepositoryWithDefaults() passed := testcmd.RunCliCommand("delete-orphaned-routes", args, reqFactory, updateCommandDependency, false)
. "github.com/cloudfoundry/cli/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("BindRouteService", func() { var ( ui *testterm.FakeUI configRepo core_config.Repository routeRepo *testapi.FakeRouteRepository routeServiceBindingRepo *testapi.FakeRouteServiceBindingRepository cmd command_registry.Command deps command_registry.Dependency factory *fakerequirements.FakeFactory flagContext flags.FlagContext fakeDomain models.DomainFields loginRequirement requirements.Requirement domainRequirement *fakerequirements.FakeDomainRequirement serviceInstanceRequirement *fakerequirements.FakeServiceInstanceRequirement ) BeforeEach(func() { ui = &testterm.FakeUI{} configRepo = testconfig.NewRepositoryWithDefaults() routeRepo = &testapi.FakeRouteRepository{} repoLocator := deps.RepoLocator.SetRouteRepository(routeRepo)
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 ( cmd *DeleteApp ui *testterm.FakeUI app models.Application configRepo configuration.ReadWriter appRepo *testapi.FakeApplicationRepository routeRepo *testapi.FakeRouteRepository requirementsFactory *testreq.FakeReqFactory ) BeforeEach(func() { app = models.Application{} app.Name = "app-to-delete" app.Guid = "app-to-delete-guid" ui = &testterm.FakeUI{} appRepo = &testapi.FakeApplicationRepository{} routeRepo = &testapi.FakeRouteRepository{} requirementsFactory = &testreq.FakeReqFactory{}
testterm "github.com/cloudfoundry/cli/testhelpers/terminal" . "github.com/cloudfoundry/cli/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("CheckRoute", func() { var ( ui *testterm.FakeUI configRepo core_config.Repository routeRepo *fakeapi.FakeRouteRepository domainRepo *fakeapi.FakeDomainRepository cmd command_registry.Command deps command_registry.Dependency factory *fakerequirements.FakeFactory flagContext flags.FlagContext loginRequirement requirements.Requirement targetedOrgRequirement *fakerequirements.FakeTargetedOrgRequirement minAPIVersionRequirement requirements.Requirement ) BeforeEach(func() { ui = &testterm.FakeUI{} configRepo = testconfig.NewRepositoryWithDefaults() routeRepo = &fakeapi.FakeRouteRepository{} repoLocator := deps.RepoLocator.SetRouteRepository(routeRepo)
"github.com/cloudfoundry/cli/cf/configuration/core_config" "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/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/cloudfoundry/cli/testhelpers/matchers" ) var _ = Describe("routes command", func() { var ( ui *testterm.FakeUI routeRepo *testapi.FakeRouteRepository configRepo core_config.ReadWriter requirementsFactory *testreq.FakeReqFactory ) BeforeEach(func() { ui = &testterm.FakeUI{} configRepo = testconfig.NewRepositoryWithDefaults() requirementsFactory = &testreq.FakeReqFactory{ LoginSuccess: true, TargetedSpaceSuccess: true, } routeRepo = &testapi.FakeRouteRepository{} }) runCommand := func(args ...string) bool { cmd := NewListRoutes(ui, configRepo, routeRepo)
"github.com/cloudfoundry/cli/cf/configuration/core_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/cloudfoundry/cli/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("check-route command", func() { var ( ui *testterm.FakeUI routeRepo *testapi.FakeRouteRepository domainRepo *testapi.FakeDomainRepository requirementsFactory *testreq.FakeReqFactory config core_config.Repository deps command_registry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.Ui = ui deps.RepoLocator = deps.RepoLocator.SetRouteRepository(routeRepo) deps.RepoLocator = deps.RepoLocator.SetDomainRepository(domainRepo) deps.Config = config command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("check-route").SetDependency(deps, pluginCall)) } BeforeEach(func() { ui = &testterm.FakeUI{} routeRepo = &testapi.FakeRouteRepository{}
"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("check-route command", func() { var ( ui *testterm.FakeUI routeRepo *testapi.FakeRouteRepository domainRepo *testapi.FakeDomainRepository requirementsFactory *testreq.FakeReqFactory config core_config.Repository deps command_registry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.Ui = ui deps.RepoLocator = deps.RepoLocator.SetRouteRepository(routeRepo) deps.RepoLocator = deps.RepoLocator.SetDomainRepository(domainRepo) deps.Config = config command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("check-route").SetDependency(deps, pluginCall)) } BeforeEach(func() { ui = &testterm.FakeUI{} routeRepo = &testapi.FakeRouteRepository{}
. "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.FakeServiceRepository wordGenerator *testwords.FakeWordGenerator requirementsFactory *testreq.FakeReqFactory authRepo *testapi.FakeAuthenticationRepository actor *fakeactors.FakePushActor appfiles *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
testterm "github.com/cloudfoundry/cli/testhelpers/terminal" . "github.com/cloudfoundry/cli/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("DeleteRoute", func() { var ( ui *testterm.FakeUI configRepo core_config.Repository routeRepo *fakeapi.FakeRouteRepository cmd command_registry.Command deps command_registry.Dependency factory *fakerequirements.FakeFactory flagContext flags.FlagContext loginRequirement requirements.Requirement domainRequirement *fakerequirements.FakeDomainRequirement minAPIVersionRequirement requirements.Requirement fakeDomain models.DomainFields ) BeforeEach(func() { ui = &testterm.FakeUI{} configRepo = testconfig.NewRepositoryWithDefaults() routeRepo = &fakeapi.FakeRouteRepository{} repoLocator := deps.RepoLocator.SetRouteRepository(routeRepo)
"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/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/cloudfoundry/cli/testhelpers/matchers" ) var _ = Describe("delete-route command", func() { var ( ui *testterm.FakeUI requirementsFactory *testreq.FakeReqFactory routeRepo *testapi.FakeRouteRepository deps command_registry.Dependency configRepo core_config.Repository ) updateCommandDependency := func(pluginCall bool) { deps.Ui = ui deps.RepoLocator = deps.RepoLocator.SetRouteRepository(routeRepo) deps.Config = configRepo command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("delete-route").SetDependency(deps, pluginCall)) } BeforeEach(func() { ui = &testterm.FakeUI{Inputs: []string{"yes"}} routeRepo = &testapi.FakeRouteRepository{}
. "github.com/cloudfoundry/cli/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("UnmapRoute", func() { var ( ui *testterm.FakeUI configRepo core_config.Repository routeRepo *fakeapi.FakeRouteRepository cmd command_registry.Command deps command_registry.Dependency factory *fakerequirements.FakeFactory flagContext flags.FlagContext loginRequirement requirements.Requirement applicationRequirement *fakerequirements.FakeApplicationRequirement domainRequirement *fakerequirements.FakeDomainRequirement minAPIVersionRequirement requirements.Requirement fakeDomain models.DomainFields ) BeforeEach(func() { ui = &testterm.FakeUI{} configRepo = testconfig.NewRepositoryWithDefaults() routeRepo = &fakeapi.FakeRouteRepository{} repoLocator := deps.RepoLocator.SetRouteRepository(routeRepo)
"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/cf/commands/route" . "github.com/cloudfoundry/cli/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("create-route command", func() { var ( ui *testterm.FakeUI routeRepo *testapi.FakeRouteRepository requirementsFactory *testreq.FakeReqFactory config configuration.ReadWriter ) BeforeEach(func() { ui = &testterm.FakeUI{} routeRepo = &testapi.FakeRouteRepository{} requirementsFactory = &testreq.FakeReqFactory{} config = testconfig.NewRepositoryWithDefaults() }) runCommand := func(args ...string) { testcmd.RunCommand(NewCreateRoute(ui, config, routeRepo), args, requirementsFactory) } Describe("requirements", func() {
"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/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/cloudfoundry/cli/testhelpers/matchers" ) var _ = Describe("unmap-route command", func() { var ( ui *testterm.FakeUI configRepo core_config.Repository routeRepo *testapi.FakeRouteRepository requirementsFactory *testreq.FakeReqFactory deps command_registry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.Ui = ui deps.RepoLocator = deps.RepoLocator.SetRouteRepository(routeRepo) deps.Config = configRepo command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("unmap-route").SetDependency(deps, pluginCall)) } BeforeEach(func() { ui = new(testterm.FakeUI) configRepo = testconfig.NewRepositoryWithDefaults() routeRepo = new(testapi.FakeRouteRepository)
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/configuration/core_config" . "github.com/cloudfoundry/cli/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("map-route command", func() { var ( ui *testterm.FakeUI configRepo core_config.Repository routeRepo *testapi.FakeRouteRepository requirementsFactory *testreq.FakeReqFactory routeCreator *routeCmdFakes.FakeRouteCreator OriginalCreateRoute command_registry.Command deps command_registry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.Ui = ui deps.RepoLocator = deps.RepoLocator.SetRouteRepository(routeRepo) deps.Config = configRepo //save original create-route and restore later OriginalCreateRoute = command_registry.Commands.FindCommand("create-route") //inject fake 'CreateRoute' into registry command_registry.Register(routeCreator)
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/configuration/core_config" . "github.com/cloudfoundry/cli/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("delete-orphaned-routes command", func() { var ( ui *testterm.FakeUI routeRepo *testapi.FakeRouteRepository configRepo core_config.Repository reqFactory *testreq.FakeReqFactory deps command_registry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.Ui = ui deps.RepoLocator = deps.RepoLocator.SetRouteRepository(routeRepo) deps.Config = configRepo command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("delete-orphaned-routes").SetDependency(deps, pluginCall)) } callDeleteOrphanedRoutes := func(confirmation string, args []string, reqFactory *testreq.FakeReqFactory, routeRepo *testapi.FakeRouteRepository) (*testterm.FakeUI, bool) { ui = &testterm.FakeUI{Inputs: []string{confirmation}} configRepo = testconfig.NewRepositoryWithDefaults() passed := testcmd.RunCliCommand("delete-orphaned-routes", args, reqFactory, updateCommandDependency, false)