(t *testing.T)
| 14 | ) |
| 15 | |
| 16 | func TestDownloadToStdout_Success(t *testing.T) { |
| 17 | content := "file content" |
| 18 | mock := &mockFilesClient{ |
| 19 | downloadFn: func(arg *files.DownloadArg) (*files.FileMetadata, io.ReadCloser, error) { |
| 20 | meta := &files.FileMetadata{Size: uint64(len(content))} |
| 21 | return meta, io.NopCloser(strings.NewReader(content)), nil |
| 22 | }, |
| 23 | } |
| 24 | |
| 25 | var buf bytes.Buffer |
| 26 | err := downloadToStdout(mock, "/file.txt", &buf) |
| 27 | if err != nil { |
| 28 | t.Fatalf("unexpected error: %v", err) |
| 29 | } |
| 30 | if buf.String() != content { |
| 31 | t.Errorf("output = %q, want %q", buf.String(), content) |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | func TestDownloadToStdout_RetriesBeforeFirstByte(t *testing.T) { |
| 36 | stubRetrySleep(t) |
nothing calls this directly
no test coverage detected