. "github.com/onsi/ginkgo" . "github.com/onsi/gomega" 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" ) var _ = Describe("target command", func() { var ( orgRepo *fake_org.FakeOrganizationRepository spaceRepo *testapi.FakeSpaceRepository requirementsFactory *testreq.FakeReqFactory config core_config.Repository ui *testterm.FakeUI deps command_registry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.Ui = ui deps.Config = config deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo) deps.RepoLocator = deps.RepoLocator.SetSpaceRepository(spaceRepo) command_registry.Commands.SetCommand(command_registry.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
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/organization" . "github.com/cloudfoundry/cli/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("delete-org command", func() { var ( config core_config.ReadWriter ui *testterm.FakeUI requirementsFactory *testreq.FakeReqFactory orgRepo *test_org.FakeOrganizationRepository org models.Organization ) BeforeEach(func() { ui = &testterm.FakeUI{ Inputs: []string{"y"}, } config = testconfig.NewRepositoryWithDefaults() requirementsFactory = &testreq.FakeReqFactory{} org = models.Organization{} org.Name = "org-to-delete" org.Guid = "org-to-delete-guid" orgRepo = &test_org.FakeOrganizationRepository{}
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("create-space command", func() { var ( ui *testterm.FakeUI requirementsFactory *testreq.FakeReqFactory configSpace models.SpaceFields configOrg models.OrganizationFields configRepo core_config.Repository spaceRepo *testapi.FakeSpaceRepository orgRepo *fake_org.FakeOrganizationRepository userRepo *testapi.FakeUserRepository spaceRoleSetter user.SpaceRoleSetter spaceQuotaRepo *fakes.FakeSpaceQuotaRepository OriginalCommand command_registry.Command deps command_registry.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.SetUserRepository(userRepo) deps.Config = configRepo
. "github.com/onsi/ginkgo" . "github.com/onsi/gomega" test_org "github.com/cloudfoundry/cli/cf/api/organizations/fakes" "github.com/cloudfoundry/cli/cf/api/space_quotas/fakes" "github.com/cloudfoundry/cli/cf/errors" testcmd "github.com/cloudfoundry/cli/testhelpers/commands" "github.com/cloudfoundry/cli/testhelpers/configuration" testreq "github.com/cloudfoundry/cli/testhelpers/requirements" testterm "github.com/cloudfoundry/cli/testhelpers/terminal" ) var _ = Describe("create-quota command", func() { var ( ui *testterm.FakeUI quotaRepo *fakes.FakeSpaceQuotaRepository orgRepo *test_org.FakeOrganizationRepository requirementsFactory *testreq.FakeReqFactory ) BeforeEach(func() { ui = &testterm.FakeUI{} quotaRepo = &fakes.FakeSpaceQuotaRepository{} orgRepo = &test_org.FakeOrganizationRepository{} requirementsFactory = &testreq.FakeReqFactory{} org := models.Organization{} org.Name = "my-org" org.Guid = "my-org-guid" orgRepo.ListOrgsReturns([]models.Organization{org}, nil) orgRepo.FindByNameReturns(org, nil) })
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/securitygroup" . "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 cmd BindSecurityGroup configRepo core_config.ReadWriter fakeSecurityGroupRepo *testapi.FakeSecurityGroupRepo requirementsFactory *testreq.FakeReqFactory fakeSpaceRepo *fakes.FakeSpaceRepository fakeOrgRepo *test_org.FakeOrganizationRepository fakeSpaceBinder *zoidberg.FakeSecurityGroupSpaceBinder ) BeforeEach(func() { ui = &testterm.FakeUI{} fakeOrgRepo = &test_org.FakeOrganizationRepository{} fakeSpaceRepo = &fakes.FakeSpaceRepository{} requirementsFactory = &testreq.FakeReqFactory{} fakeSecurityGroupRepo = &testapi.FakeSecurityGroupRepo{} configRepo = testconfig.NewRepositoryWithDefaults() fakeSpaceBinder = &zoidberg.FakeSecurityGroupSpaceBinder{} cmd = NewBindSecurityGroup(ui, configRepo, fakeSecurityGroupRepo, fakeSpaceRepo, fakeOrgRepo, fakeSpaceBinder) })
var _ = Describe("Service Plans", func() { var ( actor actors.ServicePlanActor servicePlanRepo *testapi.FakeServicePlanRepo servicePlanVisibilityRepo *testapi.FakeServicePlanVisibilityRepository orgRepo *fake_orgs.FakeOrganizationRepository planBuilder *fake_plan_builder.FakePlanBuilder serviceBuilder *fake_service_builder.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/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("rename-org command", func() { var ( requirementsFactory *testreq.FakeReqFactory orgRepo *test_org.FakeOrganizationRepository ui *testterm.FakeUI configRepo core_config.Repository deps command_registry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.Ui = ui deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo) deps.Config = configRepo command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("rename-org").SetDependency(deps, pluginCall)) } BeforeEach(func() { requirementsFactory = &testreq.FakeReqFactory{} orgRepo = &test_org.FakeOrganizationRepository{} ui = new(testterm.FakeUI)
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/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("create-org command", func() { var ( config core_config.Repository ui *testterm.FakeUI requirementsFactory *testreq.FakeReqFactory orgRepo *test_org.FakeOrganizationRepository quotaRepo *test_quota.FakeQuotaRepository deps command_registry.Dependency orgRoleSetter *userCmdFakes.FakeOrgRoleSetter flagRepo *fakeflag.FakeFeatureFlagRepository OriginalCommand command_registry.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 command_registry.Register(orgRoleSetter)
"github.com/cloudfoundry/cli/cf/configuration" 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/organization" . "github.com/cloudfoundry/cli/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("create-org command", func() { var ( config configuration.ReadWriter ui *testterm.FakeUI requirementsFactory *testreq.FakeReqFactory orgRepo *test_org.FakeOrganizationRepository ) BeforeEach(func() { ui = &testterm.FakeUI{} config = testconfig.NewRepositoryWithDefaults() requirementsFactory = &testreq.FakeReqFactory{} orgRepo = &test_org.FakeOrganizationRepository{} }) runCommand := func(args ...string) { testcmd.RunCommand(NewCreateOrg(ui, config, orgRepo), args, requirementsFactory) } Describe("requirements", func() {
"github.com/cloudfoundry/cli/plugin/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("org command", func() { var ( ui *testterm.FakeUI orgRepo *test_org.FakeOrganizationRepository configRepo core_config.Repository requirementsFactory *testreq.FakeReqFactory deps command_registry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.Ui = ui deps.Config = configRepo deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo) command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("orgs").SetDependency(deps, pluginCall)) } runCommand := func(args ...string) bool { return testcmd.RunCliCommand("orgs", args, requirementsFactory, updateCommandDependency, false) }
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("Login Command", func() { var ( Flags []string Config core_config.Repository ui *testterm.FakeUI authRepo *testapi.FakeAuthenticationRepository endpointRepo *testapi.FakeEndpointRepo orgRepo *fake_organizations.FakeOrganizationRepository spaceRepo *testapi.FakeSpaceRepository org models.Organization deps command_registry.Dependency ) 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) command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("login").SetDependency(deps, pluginCall)) }
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/organization" . "github.com/cloudfoundry/cli/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("create-org command", func() { var ( config configuration.ReadWriter ui *testterm.FakeUI requirementsFactory *testreq.FakeReqFactory orgRepo *test_org.FakeOrganizationRepository quotaRepo *test_quota.FakeQuotaRepository ) BeforeEach(func() { ui = &testterm.FakeUI{} config = testconfig.NewRepositoryWithDefaults() requirementsFactory = &testreq.FakeReqFactory{} orgRepo = &test_org.FakeOrganizationRepository{} quotaRepo = &test_quota.FakeQuotaRepository{} }) runCommand := func(args ...string) { testcmd.RunCommand(NewCreateOrg(ui, config, orgRepo, quotaRepo), args, requirementsFactory) }
"github.com/cloudfoundry/cli/cf/actors" broker_builder "github.com/cloudfoundry/cli/cf/actors/broker_builder/fakes" service_builder "github.com/cloudfoundry/cli/cf/actors/service_builder/fakes" organization_fakes "github.com/cloudfoundry/cli/cf/api/organizations/fakes" "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 *broker_builder.FakeBrokerBuilder serviceBuilder *service_builder.FakeServiceBuilder orgRepo *organization_fakes.FakeOrganizationRepository serviceBroker1 models.ServiceBroker service1 models.ServiceOffering ) BeforeEach(func() { orgRepo = &organization_fakes.FakeOrganizationRepository{} brokerBuilder = &broker_builder.FakeBrokerBuilder{} serviceBuilder = &service_builder.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",
fakeBinder "github.com/cloudfoundry/cli/cf/api/security_groups/spaces/fakes" testcmd "github.com/cloudfoundry/cli/testhelpers/commands" testconfig "github.com/cloudfoundry/cli/testhelpers/configuration" . "github.com/cloudfoundry/cli/testhelpers/matchers" testreq "github.com/cloudfoundry/cli/testhelpers/requirements" 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 *fakeSecurityGroup.FakeSecurityGroupRepo orgRepo *fake_org.FakeOrganizationRepository spaceRepo *fakes.FakeSpaceRepository secBinder *fakeBinder.FakeSecurityGroupSpaceBinder requirementsFactory *testreq.FakeReqFactory configRepo core_config.Repository deps command_registry.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 command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("unbind-security-group").SetDependency(deps, pluginCall)) }
"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{}
"github.com/cloudfoundry/cli/cf/actors/plan_builder" "github.com/cloudfoundry/cli/cf/api/fakes" testorg "github.com/cloudfoundry/cli/cf/api/organizations/fakes" "github.com/cloudfoundry/cli/cf/models" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Plan builder", func() { var ( builder plan_builder.PlanBuilder planRepo *fakes.FakeServicePlanRepo visibilityRepo *fakes.FakeServicePlanVisibilityRepository orgRepo *testorg.FakeOrganizationRepository plan1 models.ServicePlanFields plan2 models.ServicePlanFields org1 models.Organization org2 models.Organization ) BeforeEach(func() { plan_builder.PlanToOrgsVisibilityMap = nil plan_builder.OrgToPlansVisibilityMap = nil planRepo = &fakes.FakeServicePlanRepo{} visibilityRepo = &fakes.FakeServicePlanVisibilityRepository{} orgRepo = &testorg.FakeOrganizationRepository{} builder = plan_builder.NewBuilder(planRepo, visibilityRepo, orgRepo)