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

Function TestGetRecursive_CreatesEmptyDirectories

cmd/get_test.go:374–406  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

372}
373
374func TestGetRecursive_CreatesEmptyDirectories(t *testing.T) {
375 tmpDir := t.TempDir()
376 dst := filepath.Join(tmpDir, "output")
377
378 mock := &mockFilesClient{
379 listFolderFn: func(arg *files.ListFolderArg) (*files.ListFolderResult, error) {
380 return &files.ListFolderResult{
381 Entries: []files.IsMetadata{
382 &files.FolderMetadata{Metadata: files.Metadata{PathDisplay: "/remote/empty"}},
383 &files.FolderMetadata{Metadata: files.Metadata{PathDisplay: "/remote/empty/nested"}},
384 },
385 HasMore: false,
386 }, nil
387 },
388 }
389
390 err := getRecursive(mock, "/remote", dst)
391 if err != nil {
392 t.Fatalf("getRecursive error: %v", err)
393 }
394
395 for _, dir := range []string{"empty", "empty/nested"} {
396 p := filepath.Join(dst, filepath.FromSlash(dir))
397 info, err := os.Stat(p)
398 if err != nil {
399 t.Errorf("directory %s not created: %v", dir, err)
400 continue
401 }
402 if !info.IsDir() {
403 t.Errorf("%s is not a directory", dir)
404 }
405 }
406}
407
408func TestGetRecursive_HandlesPagination(t *testing.T) {
409 tmpDir := t.TempDir()

Callers

nothing calls this directly

Calls 1

getRecursiveFunction · 0.85

Tested by

no test coverage detected