(t *testing.T)
| 238 | } |
| 239 | |
| 240 | func TestCpJSONMultipleSourcesOutputsMultipleResults(t *testing.T) { |
| 241 | stubFilesClient(t, &mockFilesClient{ |
| 242 | copyV2Fn: func(arg *files.RelocationArg) (*files.RelocationResult, error) { |
| 243 | name := path.Base(arg.ToPath) |
| 244 | metadata := files.NewFileMetadata(name, "id:"+name, dropbox.DBXTime(time.Time{}), dropbox.DBXTime(time.Time{}), "rev", 1) |
| 245 | metadata.PathDisplay = arg.ToPath |
| 246 | metadata.PathLower = strings.ToLower(arg.ToPath) |
| 247 | return files.NewRelocationResult(metadata), nil |
| 248 | }, |
| 249 | }) |
| 250 | |
| 251 | var stdout bytes.Buffer |
| 252 | cmd := newRelocationTestCommand(&stdout, nil) |
| 253 | |
| 254 | if err := cp(cmd, []string{"/src/a.txt", "/src/b.txt", "/dest"}); err != nil { |
| 255 | t.Fatalf("cp error: %v", err) |
| 256 | } |
| 257 | |
| 258 | got := decodeRelocationOutput(t, stdout.Bytes()) |
| 259 | if len(got.Results) != 2 { |
| 260 | t.Fatalf("results = %d, want 2", len(got.Results)) |
| 261 | } |
| 262 | if got.Results[0].Input.ToPath != "/dest/a.txt" || got.Results[1].Input.ToPath != "/dest/b.txt" { |
| 263 | t.Fatalf("results = %#v, want folder destinations", got.Results) |
| 264 | } |
| 265 | } |
| 266 | |
| 267 | func TestCpJSONErrorUsesCommandStderr(t *testing.T) { |
| 268 | stubFilesClient(t, &mockFilesClient{ |
nothing calls this directly
no test coverage detected