testterm "github.com/cloudfoundry/cli/testhelpers/terminal" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/cloudfoundry/cli/testhelpers/matchers" ) var _ = Describe("Login Command", func() { var ( Flags []string Config coreconfig.Repository ui *testterm.FakeUI authRepo *authenticationfakes.FakeAuthenticationRepository endpointRepo *coreconfigfakes.FakeEndpointRepository orgRepo *organizationsfakes.FakeOrganizationRepository spaceRepo *apifakes.FakeSpaceRepository org models.Organization deps commandregistry.Dependency minCLIVersion string minRecommendedCLIVersion string ) updateCommandDependency := func(pluginCall bool) { deps.UI = ui deps.Config = Config deps.RepoLocator = deps.RepoLocator.SetEndpointRepository(endpointRepo) deps.RepoLocator = deps.RepoLocator.SetAuthenticationRepository(authRepo) deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo) deps.RepoLocator = deps.RepoLocator.SetSpaceRepository(spaceRepo)
package requirements_test import ( "errors" "github.com/cloudfoundry/cli/cf/api/organizations/organizationsfakes" "github.com/cloudfoundry/cli/cf/models" . "github.com/cloudfoundry/cli/cf/requirements" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("OrganizationRequirement", func() { var orgRepo *organizationsfakes.FakeOrganizationRepository BeforeEach(func() { orgRepo = new(organizationsfakes.FakeOrganizationRepository) }) Context("when an org with the given name exists", func() { It("succeeds", func() { org := models.Organization{} org.Name = "my-org-name" org.GUID = "my-org-guid" orgReq := NewOrganizationRequirement("my-org-name", orgRepo) orgRepo.ListOrgsReturns([]models.Organization{org}, nil) orgRepo.FindByNameReturns(org, nil) err := orgReq.Execute() Expect(err).NotTo(HaveOccurred()) Expect(orgRepo.FindByNameArgsForCall(0)).To(Equal("my-org-name"))
. "github.com/onsi/ginkgo" . "github.com/onsi/gomega" 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/commands" . "github.com/cloudfoundry/cli/testhelpers/matchers" ) var _ = Describe("target command", func() { var ( orgRepo *organizationsfakes.FakeOrganizationRepository spaceRepo *spacesfakes.FakeSpaceRepository requirementsFactory *requirementsfakes.FakeFactory config coreconfig.Repository ui *testterm.FakeUI deps commandregistry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.UI = ui deps.Config = config deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo) deps.RepoLocator = deps.RepoLocator.SetSpaceRepository(spaceRepo) commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("target").SetDependency(deps, pluginCall)) } listSpacesStub := func(spaces []models.Space) func(func(models.Space) bool) error { return func(cb func(models.Space) bool) error { var keepGoing bool
"github.com/cloudfoundry/cli/cf/actors" "github.com/cloudfoundry/cli/cf/actors/brokerbuilder/brokerbuilderfakes" "github.com/cloudfoundry/cli/cf/actors/servicebuilder/servicebuilderfakes" "github.com/cloudfoundry/cli/cf/api/organizations/organizationsfakes" "github.com/cloudfoundry/cli/cf/errors" "github.com/cloudfoundry/cli/cf/models" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Services", func() { var ( actor actors.ServiceActor brokerBuilder *brokerbuilderfakes.FakeBrokerBuilder serviceBuilder *servicebuilderfakes.FakeServiceBuilder orgRepo *organizationsfakes.FakeOrganizationRepository serviceBroker1 models.ServiceBroker service1 models.ServiceOffering ) BeforeEach(func() { orgRepo = new(organizationsfakes.FakeOrganizationRepository) brokerBuilder = new(brokerbuilderfakes.FakeBrokerBuilder) serviceBuilder = new(servicebuilderfakes.FakeServiceBuilder) actor = actors.NewServiceHandler(orgRepo, brokerBuilder, serviceBuilder) serviceBroker1 = models.ServiceBroker{GUID: "my-service-broker-guid1", Name: "my-service-broker1"} service1 = models.ServiceOffering{ServiceOfferingFields: models.ServiceOfferingFields{ Label: "my-service1",
"github.com/cloudfoundry/cli/plugin/models" 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/cf/commands/organization" . "github.com/cloudfoundry/cli/testhelpers/matchers" ) var _ = Describe("orgs command", func() { var ( ui *testterm.FakeUI orgRepo *organizationsfakes.FakeOrganizationRepository configRepo coreconfig.Repository requirementsFactory *requirementsfakes.FakeFactory deps commandregistry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.UI = ui deps.Config = configRepo deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo) commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("orgs").SetDependency(deps, pluginCall)) } runCommand := func(args ...string) bool { return testcmd.RunCLICommand("orgs", args, requirementsFactory, updateCommandDependency, false, ui) }
var _ = Describe("Service Plans", func() { var ( actor actors.ServicePlanActor servicePlanRepo *apifakes.OldFakeServicePlanRepo servicePlanVisibilityRepo *apifakes.FakeServicePlanVisibilityRepository orgRepo *organizationsfakes.FakeOrganizationRepository planBuilder *planbuilderfakes.FakePlanBuilder serviceBuilder *servicebuilderfakes.FakeServiceBuilder privateServicePlanVisibilityFields models.ServicePlanVisibilityFields publicServicePlanVisibilityFields models.ServicePlanVisibilityFields limitedServicePlanVisibilityFields models.ServicePlanVisibilityFields publicServicePlan models.ServicePlanFields privateServicePlan models.ServicePlanFields limitedServicePlan models.ServicePlanFields publicService models.ServiceOffering mixedService models.ServiceOffering privateService models.ServiceOffering publicAndLimitedService models.ServiceOffering org1 models.Organization org2 models.Organization visibility1 models.ServicePlanVisibilityFields ) BeforeEach(func() {
"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
"github.com/cloudfoundry/cli/cf/configuration/coreconfig" "github.com/cloudfoundry/cli/cf/models" 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("delete-org command", func() { var ( config coreconfig.Repository ui *testterm.FakeUI requirementsFactory *requirementsfakes.FakeFactory orgRepo *organizationsfakes.FakeOrganizationRepository org models.Organization deps commandregistry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.UI = ui deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo) deps.Config = config commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("delete-org").SetDependency(deps, pluginCall)) } BeforeEach(func() { ui = &testterm.FakeUI{ Inputs: []string{"y"}, }
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/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("bind-security-group command", func() { var ( ui *testterm.FakeUI configRepo coreconfig.Repository fakeSecurityGroupRepo *securitygroupsfakes.FakeSecurityGroupRepo requirementsFactory *testreq.FakeReqFactory fakeSpaceRepo *apifakes.FakeSpaceRepository fakeOrgRepo *organizationsfakes.FakeOrganizationRepository fakeSpaceBinder *spacesfakes.FakeSecurityGroupSpaceBinder deps commandregistry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.UI = ui deps.RepoLocator = deps.RepoLocator.SetSpaceRepository(fakeSpaceRepo) deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(fakeOrgRepo) deps.RepoLocator = deps.RepoLocator.SetSecurityGroupRepository(fakeSecurityGroupRepo) deps.RepoLocator = deps.RepoLocator.SetSecurityGroupSpaceBinder(fakeSpaceBinder) deps.Config = configRepo commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("bind-security-group").SetDependency(deps, pluginCall)) }
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("create-space command", func() { var ( ui *testterm.FakeUI requirementsFactory *requirementsfakes.FakeFactory configOrg models.OrganizationFields configRepo coreconfig.Repository spaceRepo *spacesfakes.FakeSpaceRepository orgRepo *organizationsfakes.FakeOrganizationRepository userRepo *apifakes.FakeUserRepository spaceRoleSetter user.SpaceRoleSetter flagRepo *featureflagsfakes.FakeFeatureFlagRepository spaceQuotaRepo *spacequotasfakes.FakeSpaceQuotaRepository OriginalCommand commandregistry.Command deps commandregistry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.UI = ui deps.RepoLocator = deps.RepoLocator.SetSpaceRepository(spaceRepo) deps.RepoLocator = deps.RepoLocator.SetSpaceQuotaRepository(spaceQuotaRepo) deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo) deps.RepoLocator = deps.RepoLocator.SetFeatureFlagRepository(flagRepo) deps.RepoLocator = deps.RepoLocator.SetUserRepository(userRepo) deps.Config = configRepo
"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/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/cloudfoundry/cli/testhelpers/matchers" ) var _ = Describe("rename-org command", func() { var ( requirementsFactory *requirementsfakes.FakeFactory orgRepo *organizationsfakes.FakeOrganizationRepository ui *testterm.FakeUI configRepo coreconfig.Repository deps commandregistry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.UI = ui deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo) deps.Config = configRepo commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("rename-org").SetDependency(deps, pluginCall)) } BeforeEach(func() { requirementsFactory = new(requirementsfakes.FakeFactory) orgRepo = new(organizationsfakes.FakeOrganizationRepository) ui = new(testterm.FakeUI)
"github.com/cloudfoundry/cli/cf/api/securitygroups/securitygroupsfakes" "github.com/cloudfoundry/cli/cf/api/securitygroups/spaces/spacesfakes" testcmd "github.com/cloudfoundry/cli/testhelpers/commands" testconfig "github.com/cloudfoundry/cli/testhelpers/configuration" . "github.com/cloudfoundry/cli/testhelpers/matchers" testterm "github.com/cloudfoundry/cli/testhelpers/terminal" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("unbind-security-group command", func() { var ( ui *testterm.FakeUI securityGroupRepo *securitygroupsfakes.FakeSecurityGroupRepo orgRepo *organizationsfakes.FakeOrganizationRepository spaceRepo *apifakes.FakeSpaceRepository secBinder *spacesfakes.FakeSecurityGroupSpaceBinder requirementsFactory *requirementsfakes.FakeFactory configRepo coreconfig.Repository deps commandregistry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.UI = ui deps.RepoLocator = deps.RepoLocator.SetSpaceRepository(spaceRepo) deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo) deps.RepoLocator = deps.RepoLocator.SetSecurityGroupRepository(securityGroupRepo) deps.RepoLocator = deps.RepoLocator.SetSecurityGroupSpaceBinder(secBinder) deps.Config = configRepo commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("unbind-security-group").SetDependency(deps, pluginCall)) }
"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("delete-space-quota command", func() { var ( ui *testterm.FakeUI quotaRepo *spacequotasfakes.FakeSpaceQuotaRepository orgRepo *organizationsfakes.FakeOrganizationRepository requirementsFactory *testreq.FakeReqFactory configRepo coreconfig.Repository deps commandregistry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.UI = ui deps.Config = configRepo deps.RepoLocator = deps.RepoLocator.SetSpaceQuotaRepository(quotaRepo) deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo) commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("delete-space-quota").SetDependency(deps, pluginCall)) } BeforeEach(func() { ui = &testterm.FakeUI{} quotaRepo = new(spacequotasfakes.FakeSpaceQuotaRepository)
testreq "github.com/cloudfoundry/cli/testhelpers/requirements" testterm "github.com/cloudfoundry/cli/testhelpers/terminal" "github.com/cloudfoundry/cli/cf/commandregistry" . "github.com/cloudfoundry/cli/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("create-org command", func() { var ( config coreconfig.Repository ui *testterm.FakeUI requirementsFactory *testreq.FakeReqFactory orgRepo *organizationsfakes.FakeOrganizationRepository quotaRepo *quotasfakes.FakeQuotaRepository deps commandregistry.Dependency orgRoleSetter *userfakes.FakeOrgRoleSetter flagRepo *featureflagsfakes.FakeFeatureFlagRepository OriginalCommand commandregistry.Command ) updateCommandDependency := func(pluginCall bool) { deps.UI = ui deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo) deps.RepoLocator = deps.RepoLocator.SetQuotaRepository(quotaRepo) deps.RepoLocator = deps.RepoLocator.SetFeatureFlagRepository(flagRepo) deps.Config = config //inject fake 'command dependency' into registry commandregistry.Register(orgRoleSetter)
"github.com/cloudfoundry/cli/cf/actors/planbuilder" "github.com/cloudfoundry/cli/cf/api/apifakes" "github.com/cloudfoundry/cli/cf/api/organizations/organizationsfakes" "github.com/cloudfoundry/cli/cf/models" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Plan builder", func() { var ( builder planbuilder.PlanBuilder planRepo *apifakes.OldFakeServicePlanRepo visibilityRepo *apifakes.FakeServicePlanVisibilityRepository orgRepo *organizationsfakes.FakeOrganizationRepository plan1 models.ServicePlanFields plan2 models.ServicePlanFields org1 models.Organization org2 models.Organization ) BeforeEach(func() { planbuilder.PlanToOrgsVisibilityMap = nil planbuilder.OrgToPlansVisibilityMap = nil planRepo = new(apifakes.OldFakeServicePlanRepo) visibilityRepo = new(apifakes.FakeServicePlanVisibilityRepository) orgRepo = new(organizationsfakes.FakeOrganizationRepository) builder = planbuilder.NewBuilder(planRepo, visibilityRepo, orgRepo)