MCPcopy Create free account
hub / github.com/dropbox/dbxcli / TestDownloadToStdout_Success

Function TestDownloadToStdout_Success

cmd/stdout_test.go:16–33  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

14)
15
16func 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
35func TestDownloadToStdout_RetriesBeforeFirstByte(t *testing.T) {
36 stubRetrySleep(t)

Callers

nothing calls this directly

Calls 1

downloadToStdoutFunction · 0.85

Tested by

no test coverage detected