(t *testing.T)
| 139 | } |
| 140 | |
| 141 | func TestGetDstAppendsToDirectory(t *testing.T) { |
| 142 | tmpDir := t.TempDir() |
| 143 | |
| 144 | content := "pdf content" |
| 145 | mock := &mockFilesClient{ |
| 146 | downloadFn: func(arg *files.DownloadArg) (*files.FileMetadata, io.ReadCloser, error) { |
| 147 | if arg.Path != "/remote/doc.pdf" { |
| 148 | t.Errorf("download path = %q, want %q", arg.Path, "/remote/doc.pdf") |
| 149 | } |
| 150 | meta := &files.FileMetadata{ |
| 151 | Metadata: files.Metadata{PathDisplay: "/remote/doc.pdf"}, |
| 152 | Size: uint64(len(content)), |
| 153 | } |
| 154 | return meta, io.NopCloser(strings.NewReader(content)), nil |
| 155 | }, |
| 156 | } |
| 157 | |
| 158 | err := getWithClient(mock, []string{"/remote/doc.pdf", tmpDir}) |
| 159 | if err != nil { |
| 160 | t.Fatalf("expected nil error, got %v", err) |
| 161 | } |
| 162 | got, err := os.ReadFile(filepath.Join(tmpDir, "doc.pdf")) |
| 163 | if err != nil { |
| 164 | t.Fatalf("failed to read downloaded file: %v", err) |
| 165 | } |
| 166 | if string(got) != content { |
| 167 | t.Errorf("got %q, want %q", string(got), content) |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | func TestGetDownloadWithRetry(t *testing.T) { |
| 172 | stubRetrySleep(t) |
nothing calls this directly
no test coverage detected