"code.cloudfoundry.org/cli/cf/requirements" "code.cloudfoundry.org/cli/cf/requirements/requirementsfakes" testcmd "code.cloudfoundry.org/cli/testhelpers/commands" testconfig "code.cloudfoundry.org/cli/testhelpers/configuration" testterm "code.cloudfoundry.org/cli/testhelpers/terminal" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "code.cloudfoundry.org/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)
"code.cloudfoundry.org/cli/cf/requirements" "code.cloudfoundry.org/cli/cf/requirements/requirementsfakes" testcmd "code.cloudfoundry.org/cli/testhelpers/commands" testconfig "code.cloudfoundry.org/cli/testhelpers/configuration" testterm "code.cloudfoundry.org/cli/testhelpers/terminal" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "code.cloudfoundry.org/cli/cf/commands/service" . "code.cloudfoundry.org/cli/testhelpers/matchers" ) var _ = Describe("marketplace command", func() { var ui *testterm.FakeUI var requirementsFactory *requirementsfakes.FakeFactory var config coreconfig.Repository var serviceBuilder *servicebuilderfakes.FakeServiceBuilder var fakeServiceOfferings []models.ServiceOffering var serviceWithAPaidPlan models.ServiceOffering var service2 models.ServiceOffering var deps commandregistry.Dependency updateCommandDependency := func(pluginCall bool) { deps.UI = ui deps.Config = config deps.ServiceBuilder = serviceBuilder commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("marketplace").SetDependency(deps, pluginCall)) } BeforeEach(func() { serviceBuilder = new(servicebuilderfakes.FakeServiceBuilder)
testcmd "code.cloudfoundry.org/cli/testhelpers/commands" testconfig "code.cloudfoundry.org/cli/testhelpers/configuration" testterm "code.cloudfoundry.org/cli/testhelpers/terminal" "code.cloudfoundry.org/cli/cf/commandregistry" "code.cloudfoundry.org/cli/cf/commands/application" . "code.cloudfoundry.org/cli/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("stop command", func() { var ( ui *testterm.FakeUI app models.Application appRepo *applicationsfakes.FakeRepository requirementsFactory *requirementsfakes.FakeFactory config coreconfig.Repository deps commandregistry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.UI = ui deps.RepoLocator = deps.RepoLocator.SetApplicationRepository(appRepo) deps.Config = config commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("stop").SetDependency(deps, pluginCall)) } BeforeEach(func() { ui = &testterm.FakeUI{} config = testconfig.NewRepositoryWithDefaults() appRepo = new(applicationsfakes.FakeRepository)
testterm "code.cloudfoundry.org/cli/testhelpers/terminal" "code.cloudfoundry.org/cli/cf/trace/tracefakes" . "code.cloudfoundry.org/cli/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("SSH command", func() { var ( ui *testterm.FakeUI sshCodeGetter *commandsfakes.FakeSSHCodeGetter originalSSHCodeGetter commandregistry.Command requirementsFactory *requirementsfakes.FakeFactory configRepo coreconfig.Repository deps commandregistry.Dependency ccGateway net.Gateway fakeSecureShell *sshfakes.FakeSecureShell ) BeforeEach(func() { ui = &testterm.FakeUI{} configRepo = testconfig.NewRepositoryWithDefaults() requirementsFactory = new(requirementsfakes.FakeFactory) deps.Gateways = make(map[string]net.Gateway) //save original command and restore later originalSSHCodeGetter = commandregistry.Commands.FindCommand("ssh-code")
testterm "code.cloudfoundry.org/cli/testhelpers/terminal" . "code.cloudfoundry.org/cli/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("UnsetOrgRole", func() { var ( ui *testterm.FakeUI configRepo coreconfig.Repository userRepo *testapi.FakeUserRepository flagRepo *featureflagsfakes.FakeFeatureFlagRepository cmd commandregistry.Command deps commandregistry.Dependency factory *requirementsfakes.FakeFactory flagContext flags.FlagContext loginRequirement requirements.Requirement userRequirement *requirementsfakes.FakeUserRequirement organizationRequirement *requirementsfakes.FakeOrganizationRequirement ) BeforeEach(func() { ui = &testterm.FakeUI{} configRepo = testconfig.NewRepositoryWithDefaults() userRepo = &testapi.FakeUserRepository{} repoLocator := deps.RepoLocator.SetUserRepository(userRepo) flagRepo = new(featureflagsfakes.FakeFeatureFlagRepository) repoLocator = repoLocator.SetFeatureFlagRepository(flagRepo)
"code.cloudfoundry.org/cli/cf/requirements" "code.cloudfoundry.org/cli/cf/requirements/requirementsfakes" testcmd "code.cloudfoundry.org/cli/testhelpers/commands" testconfig "code.cloudfoundry.org/cli/testhelpers/configuration" testterm "code.cloudfoundry.org/cli/testhelpers/terminal" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "code.cloudfoundry.org/cli/testhelpers/matchers" ) var _ = Describe("delete-space command", func() { var ( ui *testterm.FakeUI space models.Space config coreconfig.Repository spaceRepo *spacesfakes.FakeSpaceRepository requirementsFactory *requirementsfakes.FakeFactory deps commandregistry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.UI = ui deps.RepoLocator = deps.RepoLocator.SetSpaceRepository(spaceRepo) deps.Config = config commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("delete-space").SetDependency(deps, pluginCall)) } runCommand := func(args ...string) bool { return testcmd.RunCLICommand("delete-space", args, requirementsFactory, updateCommandDependency, false, ui) }
. "github.com/onsi/ginkgo" . "github.com/onsi/gomega" testcmd "code.cloudfoundry.org/cli/testhelpers/commands" testconfig "code.cloudfoundry.org/cli/testhelpers/configuration" testterm "code.cloudfoundry.org/cli/testhelpers/terminal" "code.cloudfoundry.org/cli/cf/commands" . "code.cloudfoundry.org/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
Expect(err).ToNot(HaveOccurred()) var success bool err = client.Call("CliRpcCmd.CallCoreCommand", []string{"fake-command3"}, &success) Expect(err).ToNot(HaveOccurred()) Expect(runner.CommandCallCount()).To(Equal(1)) _, _, pluginApiCall := runner.CommandArgsForCall(0) Expect(pluginApiCall).To(BeFalse()) }) }) Describe("CLI Config object methods", func() { var ( config coreconfig.Repository ) BeforeEach(func() { config = testconfig.NewRepositoryWithDefaults() }) AfterEach(func() { rpcService.Stop() //give time for server to stop time.Sleep(50 * time.Millisecond) }) Context(".GetCurrentOrg", func() { BeforeEach(func() {
"code.cloudfoundry.org/cli/cf/requirements" "code.cloudfoundry.org/cli/cf/requirements/requirementsfakes" testcmd "code.cloudfoundry.org/cli/testhelpers/commands" testconfig "code.cloudfoundry.org/cli/testhelpers/configuration" testterm "code.cloudfoundry.org/cli/testhelpers/terminal" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "code.cloudfoundry.org/cli/testhelpers/matchers" ) var _ = Describe("delete-user command", func() { var ( ui *testterm.FakeUI configRepo coreconfig.Repository userRepo *apifakes.FakeUserRepository requirementsFactory *requirementsfakes.FakeFactory deps commandregistry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.UI = ui deps.Config = configRepo deps.RepoLocator = deps.RepoLocator.SetUserRepository(userRepo) commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("delete-user").SetDependency(deps, pluginCall)) } BeforeEach(func() { ui = &testterm.FakeUI{Inputs: []string{"y"}} userRepo = new(apifakes.FakeUserRepository) requirementsFactory = new(requirementsfakes.FakeFactory)
package requirements_test import ( "code.cloudfoundry.org/cli/cf/configuration/coreconfig" "code.cloudfoundry.org/cli/cf/requirements" "github.com/blang/semver" testconfig "code.cloudfoundry.org/cli/testhelpers/configuration" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("MaxAPIVersionRequirement", func() { var ( config coreconfig.Repository requirement requirements.MaxAPIVersionRequirement ) BeforeEach(func() { config = testconfig.NewRepository() maximumVersion, err := semver.Make("1.2.3") Expect(err).NotTo(HaveOccurred()) requirement = requirements.NewMaxAPIVersionRequirement(config, "version-restricted-feature", maximumVersion) }) Context("Execute", func() { Context("when the config's api version is less than the maximum version", func() { BeforeEach(func() { config.SetAPIVersion("1.2.2") })
"code.cloudfoundry.org/cli/cf/errors" "code.cloudfoundry.org/cli/cf/models" "code.cloudfoundry.org/cli/cf/net" "code.cloudfoundry.org/cli/cf/terminal/terminalfakes" "code.cloudfoundry.org/cli/cf/trace/tracefakes" testconfig "code.cloudfoundry.org/cli/testhelpers/configuration" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/onsi/gomega/ghttp" ) var _ = Describe("RoutingApi", func() { var ( repo api.RoutingAPIRepository configRepo coreconfig.Repository routingAPIServer *ghttp.Server ) BeforeEach(func() { configRepo = testconfig.NewRepositoryWithDefaults() gateway := net.NewRoutingAPIGateway(configRepo, time.Now, new(terminalfakes.FakeUI), new(tracefakes.FakePrinter), "") repo = api.NewRoutingAPIRepository(configRepo, gateway) }) AfterEach(func() { routingAPIServer.Close() }) Describe("ListRouterGroups", func() {
"code.cloudfoundry.org/cli/cf/commandregistry" "code.cloudfoundry.org/cli/cf/configuration/coreconfig" "code.cloudfoundry.org/cli/cf/requirements/requirementsfakes" testcmd "code.cloudfoundry.org/cli/testhelpers/commands" testconfig "code.cloudfoundry.org/cli/testhelpers/configuration" testterm "code.cloudfoundry.org/cli/testhelpers/terminal" . "code.cloudfoundry.org/cli/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("config command", func() { var ( ui *testterm.FakeUI configRepo coreconfig.Repository requirementsFactory *requirementsfakes.FakeFactory deps commandregistry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.UI = ui deps.Config = configRepo commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("config").SetDependency(deps, pluginCall)) } BeforeEach(func() { ui = &testterm.FakeUI{} configRepo = testconfig.NewRepositoryWithDefaults() requirementsFactory = new(requirementsfakes.FakeFactory) })
testconfig "code.cloudfoundry.org/cli/testhelpers/configuration" testterm "code.cloudfoundry.org/cli/testhelpers/terminal" clipr "github.com/cloudfoundry-incubator/cli-plugin-repo/web" "code.cloudfoundry.org/cli/cf/flags" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("repo-plugins", func() { var ( ui *testterm.FakeUI config coreconfig.Repository requirementsFactory *requirementsfakes.FakeFactory fakePluginRepo *pluginrepofakes.FakePluginRepo deps commandregistry.Dependency cmd *pluginrepo.RepoPlugins flagContext flags.FlagContext ) BeforeEach(func() { fakePluginRepo = new(pluginrepofakes.FakePluginRepo) ui = &testterm.FakeUI{} requirementsFactory = new(requirementsfakes.FakeFactory) config = testconfig.NewRepositoryWithDefaults() deps = commandregistry.Dependency{ UI: ui, Config: config, PluginRepo: fakePluginRepo,
testterm "code.cloudfoundry.org/cli/testhelpers/terminal" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "code.cloudfoundry.org/cli/testhelpers/matchers" ) var _ = Describe("Login Command", func() { var ( Flags []string Config coreconfig.Repository ui *testterm.FakeUI authRepo *authenticationfakes.FakeRepository endpointRepo *coreconfigfakes.FakeEndpointRepository orgRepo *organizationsfakes.FakeOrganizationRepository spaceRepo *spacesfakes.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)
"os" "path/filepath" "code.cloudfoundry.org/cli/cf/configuration" "code.cloudfoundry.org/cli/cf/configuration/configurationfakes" "code.cloudfoundry.org/cli/cf/configuration/coreconfig" "code.cloudfoundry.org/cli/cf/models" "github.com/blang/semver" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Configuration Repository", func() { var ( config coreconfig.Repository persistor *configurationfakes.FakePersistor ) BeforeEach(func() { persistor = new(configurationfakes.FakePersistor) persistor.ExistsReturns(true) config = coreconfig.NewRepositoryFromPersistor(persistor, func(err error) { panic(err) }) }) It("is threadsafe", func() { performSaveCh := make(chan struct{}) beginSaveCh := make(chan struct{}) finishSaveCh := make(chan struct{}) finishReadCh := make(chan struct{}) persistor.SaveStub = func(configuration.DataInterface) error {
import ( "code.cloudfoundry.org/cli/cf/commandregistry" "code.cloudfoundry.org/cli/cf/configuration/coreconfig" "code.cloudfoundry.org/cli/cf/models" testcmd "code.cloudfoundry.org/cli/testhelpers/commands" testconfig "code.cloudfoundry.org/cli/testhelpers/configuration" testterm "code.cloudfoundry.org/cli/testhelpers/terminal" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("logout command", func() { var ( config coreconfig.Repository ui *testterm.FakeUI deps commandregistry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.UI = ui deps.Config = config commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("logout").SetDependency(deps, pluginCall)) } BeforeEach(func() { org := models.OrganizationFields{} org.Name = "MyOrg" space := models.SpaceFields{} space.Name = "MySpace"
testcmd "code.cloudfoundry.org/cli/testhelpers/commands" testconfig "code.cloudfoundry.org/cli/testhelpers/configuration" testterm "code.cloudfoundry.org/cli/testhelpers/terminal" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "os" . "code.cloudfoundry.org/cli/testhelpers/matchers" ) var _ = Describe("org-users command", func() { var ( ui *testterm.FakeUI requirementsFactory *requirementsfakes.FakeFactory configRepo coreconfig.Repository userRepo *apifakes.FakeUserRepository deps commandregistry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.UI = ui deps.Config = configRepo deps.RepoLocator = deps.RepoLocator.SetUserRepository(userRepo) commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("org-users").SetDependency(deps, pluginCall)) } BeforeEach(func() { ui = &testterm.FakeUI{} userRepo = new(apifakes.FakeUserRepository)
"code.cloudfoundry.org/cli/cf/commandregistry" "code.cloudfoundry.org/cli/cf/configuration/coreconfig" "code.cloudfoundry.org/cli/cf/models" "code.cloudfoundry.org/cli/cf/requirements/requirementsfakes" . "code.cloudfoundry.org/cli/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("add-plugin-repo", func() { var ( ui *testterm.FakeUI config coreconfig.Repository requirementsFactory *requirementsfakes.FakeFactory testServer *httptest.Server deps commandregistry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.UI = ui deps.Config = config commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("add-plugin-repo").SetDependency(deps, pluginCall)) } BeforeEach(func() { ui = &testterm.FakeUI{} requirementsFactory = new(requirementsfakes.FakeFactory) config = testconfig.NewRepositoryWithDefaults() })
"code.cloudfoundry.org/cli/cf/commandregistry" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "code.cloudfoundry.org/cli/testhelpers/matchers" ) var _ = Describe("create-service command", func() { var ( ui *testterm.FakeUI config coreconfig.Repository requirementsFactory *requirementsfakes.FakeFactory serviceRepo *apifakes.FakeServiceRepository serviceBuilder *servicebuilderfakes.FakeServiceBuilder offering1 models.ServiceOffering offering2 models.ServiceOffering deps commandregistry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.UI = ui deps.Config = config deps.RepoLocator = deps.RepoLocator.SetServiceRepository(serviceRepo) deps.ServiceBuilder = serviceBuilder commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("create-service").SetDependency(deps, pluginCall)) } BeforeEach(func() {
package requirements_test import ( "code.cloudfoundry.org/cli/cf/configuration/coreconfig" "code.cloudfoundry.org/cli/cf/requirements" testconfig "code.cloudfoundry.org/cli/testhelpers/configuration" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("RoutingApi", func() { var ( config coreconfig.Repository requirement requirements.RoutingAPIRequirement ) BeforeEach(func() { config = testconfig.NewRepositoryWithAccessToken(coreconfig.TokenInfo{Username: "******"}) requirement = requirements.NewRoutingAPIRequirement(config) }) Context("when the config has a zero-length RoutingAPIEndpoint", func() { BeforeEach(func() { config.SetRoutingAPIEndpoint("") }) It("errors", func() { err := requirement.Execute() Expect(err.Error()).To(ContainSubstring("This command requires the Routing API. Your targeted endpoint reports it is not enabled."))
testterm "code.cloudfoundry.org/cli/testhelpers/terminal" "code.cloudfoundry.org/cli/cf/commandregistry" "code.cloudfoundry.org/cli/cf/configuration/coreconfig" "code.cloudfoundry.org/cli/cf/models" "code.cloudfoundry.org/cli/cf/requirements/requirementsfakes" . "code.cloudfoundry.org/cli/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("delte-plugin-repo", func() { var ( ui *testterm.FakeUI config coreconfig.Repository requirementsFactory *requirementsfakes.FakeFactory deps commandregistry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.UI = ui deps.Config = config commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("remove-plugin-repo").SetDependency(deps, pluginCall)) } BeforeEach(func() { ui = &testterm.FakeUI{} requirementsFactory = new(requirementsfakes.FakeFactory) config = testconfig.NewRepositoryWithDefaults() })
testconfig "code.cloudfoundry.org/cli/testhelpers/configuration" testterm "code.cloudfoundry.org/cli/testhelpers/terminal" "code.cloudfoundry.org/cli/cf/commandregistry" . "code.cloudfoundry.org/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 *requirementsfakes.FakeFactory 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)
testcmd "code.cloudfoundry.org/cli/testhelpers/commands" testconfig "code.cloudfoundry.org/cli/testhelpers/configuration" testterm "code.cloudfoundry.org/cli/testhelpers/terminal" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "os" . "code.cloudfoundry.org/cli/testhelpers/matchers" ) var _ = Describe("auth command", func() { var ( ui *testterm.FakeUI config coreconfig.Repository authRepo *authenticationfakes.FakeRepository requirementsFactory *requirementsfakes.FakeFactory deps commandregistry.Dependency fakeLogger *tracefakes.FakePrinter ) updateCommandDependency := func(pluginCall bool) { deps.UI = ui deps.Config = config deps.RepoLocator = deps.RepoLocator.SetAuthenticationRepository(authRepo) commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("auth").SetDependency(deps, pluginCall)) } BeforeEach(func() { ui = &testterm.FakeUI{} config = testconfig.NewRepositoryWithDefaults() requirementsFactory = new(requirementsfakes.FakeFactory)
"code.cloudfoundry.org/cli/cf/configuration/coreconfig" "code.cloudfoundry.org/cli/cf/models" testcmd "code.cloudfoundry.org/cli/testhelpers/commands" testconfig "code.cloudfoundry.org/cli/testhelpers/configuration" testterm "code.cloudfoundry.org/cli/testhelpers/terminal" . "code.cloudfoundry.org/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"}, }
"code.cloudfoundry.org/cli/cf/requirements/requirementsfakes" testcmd "code.cloudfoundry.org/cli/testhelpers/commands" testconfig "code.cloudfoundry.org/cli/testhelpers/configuration" testterm "code.cloudfoundry.org/cli/testhelpers/terminal" . "code.cloudfoundry.org/cli/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("list-plugin-repo", func() { var ( ui *testterm.FakeUI config coreconfig.Repository requirementsFactory *requirementsfakes.FakeFactory deps commandregistry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.UI = ui deps.Config = config commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("list-plugin-repos").SetDependency(deps, pluginCall)) } BeforeEach(func() { ui = &testterm.FakeUI{} requirementsFactory = new(requirementsfakes.FakeFactory) config = testconfig.NewRepositoryWithDefaults() })
"code.cloudfoundry.org/cli/cf/terminal/terminalfakes" "code.cloudfoundry.org/cli/cf/trace/tracefakes" testconfig "code.cloudfoundry.org/cli/testhelpers/configuration" testnet "code.cloudfoundry.org/cli/testhelpers/net" . "code.cloudfoundry.org/cli/cf/api" . "code.cloudfoundry.org/cli/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/onsi/gomega/ghttp" ) var _ = Describe("route repository", func() { var ( ts *httptest.Server handler *testnet.TestHandler configRepo coreconfig.Repository repo CloudControllerRouteRepository ) BeforeEach(func() { configRepo = testconfig.NewRepositoryWithDefaults() configRepo.SetSpaceFields(models.SpaceFields{ GUID: "the-space-guid", Name: "the-space-name", }) gateway := net.NewCloudControllerGateway(configRepo, time.Now, new(terminalfakes.FakeUI), new(tracefakes.FakePrinter), "") repo = NewCloudControllerRouteRepository(configRepo, gateway) }) AfterEach(func() { if ts != nil {
. "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Install", func() { var ( ui *testterm.FakeUI requirementsFactory *requirementsfakes.FakeFactory config coreconfig.Repository pluginConfig *pluginconfigfakes.FakePluginConfiguration fakePluginRepo *pluginrepofakes.FakePluginRepo fakeChecksum *utilsfakes.FakeSha1Checksum pluginFile *os.File homeDir string pluginDir string curDir string test_1 string test_2 string test_curDir string test_with_help string test_with_orgs string test_with_orgs_short_name string aliasConflicts string deps commandregistry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.UI = ui deps.Config = config deps.PluginConfig = pluginConfig
testterm "code.cloudfoundry.org/cli/testhelpers/terminal" . "code.cloudfoundry.org/cli/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("CheckRoute", func() { var ( ui *testterm.FakeUI configRepo coreconfig.Repository routeRepo *apifakes.FakeRouteRepository domainRepo *apifakes.FakeDomainRepository cmd commandregistry.Command deps commandregistry.Dependency factory *requirementsfakes.FakeFactory flagContext flags.FlagContext loginRequirement requirements.Requirement targetedOrgRequirement *requirementsfakes.FakeTargetedOrgRequirement minAPIVersionRequirement requirements.Requirement ) BeforeEach(func() { ui = &testterm.FakeUI{} configRepo = testconfig.NewRepositoryWithDefaults() routeRepo = new(apifakes.FakeRouteRepository) repoLocator := deps.RepoLocator.SetRouteRepository(routeRepo)
testterm "code.cloudfoundry.org/cli/testhelpers/terminal" "code.cloudfoundry.org/cli/cf/commandregistry" "code.cloudfoundry.org/cli/cf/configuration/coreconfig" . "code.cloudfoundry.org/cli/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("restart command", func() { var ( ui *testterm.FakeUI requirementsFactory *requirementsfakes.FakeFactory starter *applicationfakes.FakeStarter stopper *applicationfakes.FakeStopper config coreconfig.Repository app models.Application originalStop commandregistry.Command originalStart commandregistry.Command deps commandregistry.Dependency applicationReq *requirementsfakes.FakeApplicationRequirement ) updateCommandDependency := func(pluginCall bool) { deps.UI = ui deps.Config = config //inject fake 'stopper and starter' into registry commandregistry.Register(starter) commandregistry.Register(stopper) commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("restart").SetDependency(deps, pluginCall))
testconfig "code.cloudfoundry.org/cli/testhelpers/configuration" testterm "code.cloudfoundry.org/cli/testhelpers/terminal" . "code.cloudfoundry.org/cli/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("PurgeServiceOffering", func() { var ( ui *testterm.FakeUI configRepo coreconfig.Repository serviceRepo *apifakes.FakeServiceRepository cmd commandregistry.Command deps commandregistry.Dependency factory *requirementsfakes.FakeFactory flagContext flags.FlagContext loginRequirement requirements.Requirement maxAPIVersionRequirement requirements.Requirement ) BeforeEach(func() { ui = &testterm.FakeUI{} configRepo = testconfig.NewRepositoryWithDefaults() serviceRepo = new(apifakes.FakeServiceRepository) repoLocator := deps.RepoLocator.SetServiceRepository(serviceRepo) deps = commandregistry.Dependency{ UI: ui,