requirementsFactory.Application = app logsRepo.TailLogMessages = logs ui := callLogs([]string{"my-app"}, requirementsFactory, logsRepo) Expect(requirementsFactory.ApplicationName).To(Equal("my-app")) Expect(app.Guid).To(Equal(logsRepo.AppLoggedGuid)) Expect(ui.Outputs).To(ContainSubstrings( []string{"Connected, tailing logs for app", "my-app", "my-org", "my-space", "my-user"}, []string{"Log Line 1"}, )) }) Context("when the loggregator server has an invalid cert", func() { var ( requirementsFactory *testreq.FakeReqFactory logsRepo *testapi.FakeLogsRepository ) BeforeEach(func() { requirementsFactory, logsRepo = getLogsDependencies() }) Context("when the skip-ssl-validation flag is not set", func() { It("fails and informs the user about the skip-ssl-validation flag", func() { logsRepo.TailLogErr = errors.NewInvalidSSLCert("https://example.com", "it don't work good") ui := callLogs([]string{"my-app"}, requirementsFactory, logsRepo) Expect(ui.Outputs).To(ContainSubstrings( []string{"Received invalid SSL certificate", "https://example.com"}, []string{"TIP"}, ))
testlogs "github.com/cloudfoundry/cli/testhelpers/logs" testreq "github.com/cloudfoundry/cli/testhelpers/requirements" testterm "github.com/cloudfoundry/cli/testhelpers/terminal" "github.com/cloudfoundry/loggregatorlib/logmessage" . "github.com/cloudfoundry/cli/cf/commands/application" "github.com/cloudfoundry/cli/cf/configuration" . "github.com/cloudfoundry/cli/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("logs command", func() { var ( ui *testterm.FakeUI logsRepo *testapi.FakeLogsRepository requirementsFactory *testreq.FakeReqFactory configRepo configuration.ReadWriter ) BeforeEach(func() { ui = &testterm.FakeUI{} configRepo = testconfig.NewRepositoryWithDefaults() logsRepo = &testapi.FakeLogsRepository{} requirementsFactory = &testreq.FakeReqFactory{} }) runCommand := func(args ...string) { testcmd.RunCommand(NewLogs(ui, configRepo, logsRepo), args, requirementsFactory) } Describe("requirements", func() {