コード例 #1
0
ファイル: logs_test.go プロジェクト: raghulsid/cli
			noaaRepo.RecentLogsForReturns(recentLogs, nil)

			noaaRepo.TailNoaaLogsForStub = func(appGuid string, onConnect func(), onMessage func(*events.LogMessage)) error {
				onConnect()
				for _, log := range appLogs {
					onMessage(log)
				}
				return nil
			}
		})

		It("shows the recent logs when the --recent flag is provided", func() {
			runCommand("--recent", "my-app")

			Expect(requirementsFactory.ApplicationName).To(Equal("my-app"))
			Expect(app.Guid).To(Equal(noaaRepo.RecentLogsForArgsForCall(0)))
			Expect(ui.Outputs).To(ContainSubstrings(
				[]string{"Connected, dumping recent logs for app", "my-app", "my-org", "my-space", "my-user"},
				[]string{"Log Line 1"},
				[]string{"Log Line 2"},
			))
		})

		Context("when the log messages contain format string identifiers", func() {
			BeforeEach(func() {
				noaaRepo.RecentLogsForReturns([]*events.LogMessage{
					testlogs.NewNoaaLogMessage("hello%2Bworld%v", app.Guid, "DEA", time.Now()),
				}, nil)
			})

			It("does not treat them as format strings", func() {