It("extrapolates the loggregator URL based on the API URL (non-SSL API)", func() { endpoint := r.LoggregatorEndpoint(ccInfo, "http://127.0.0.1:80") Expect(endpoint).To(Equal("ws://loggregator.0.0.1:80")) }) }) }) Describe("Refresh", func() { BeforeEach(func() { config := configuration.NewRepositoryWithDefaults() i18n.T = i18n.Init(config) }) Context("when the cloud controller returns an insecure api endpoint", func() { var ( r APIConfigRefresher ccInfo *CCInfo endpointRepo *coreconfigfakes.FakeEndpointRepository ) BeforeEach(func() { ccInfo = &CCInfo{ LoggregatorEndpoint: "some-endpoint", } endpointRepo = new(coreconfigfakes.FakeEndpointRepository) r = APIConfigRefresher{ EndpointRepo: endpointRepo, Config: new(coreconfigfakes.FakeReadWriter), Endpoint: "api.some.endpoint.com", } })
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("OneTimeSSHCode", func() { var ( ui *testterm.FakeUI configRepo coreconfig.Repository authRepo *authenticationfakes.FakeRepository endpointRepo *coreconfigfakes.FakeEndpointRepository cmd commandregistry.Command deps commandregistry.Dependency factory *requirementsfakes.FakeFactory flagContext flags.FlagContext endpointRequirement requirements.Requirement ) BeforeEach(func() { ui = &testterm.FakeUI{} configRepo = testconfig.NewRepositoryWithDefaults() configRepo.SetAPIEndpoint("fake-api-endpoint") endpointRepo = new(coreconfigfakes.FakeEndpointRepository) repoLocator := deps.RepoLocator.SetEndpointRepository(endpointRepo) authRepo = new(authenticationfakes.FakeRepository)
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)
. "github.com/onsi/gomega" "code.cloudfoundry.org/cli/cf/api" "code.cloudfoundry.org/cli/cf/commands" "code.cloudfoundry.org/cli/cf/configuration/coreconfig/coreconfigfakes" "code.cloudfoundry.org/cli/cf/flags" . "code.cloudfoundry.org/cli/testhelpers/matchers" ) var _ = Describe("Api", func() { var ( config coreconfig.Repository endpointRepo *coreconfigfakes.FakeEndpointRepository deps commandregistry.Dependency requirementsFactory *requirementsfakes.FakeFactory ui *testterm.FakeUI cmd commands.API flagContext flags.FlagContext repoLocator api.RepositoryLocator runCLIErr error ) callApi := func(args []string) { err := flagContext.Parse(args...) Expect(err).NotTo(HaveOccurred()) runCLIErr = cmd.Execute(flagContext) } BeforeEach(func() { ui = new(testterm.FakeUI)