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

Function TestPutRecursive_CreatesEmptyRootDirectory

cmd/put_test.go:594–629  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

592}
593
594func TestPutRecursive_CreatesEmptyRootDirectory(t *testing.T) {
595 dir := t.TempDir()
596
597 var uploaded []string
598 var createdDirs []string
599 origConfig := config
600 defer func() { config = origConfig }()
601
602 config = testConfig()
603 testClient := &mockFilesClient{
604 uploadFn: func(arg *files.UploadArg, content io.Reader) (*files.FileMetadata, error) {
605 uploaded = append(uploaded, arg.Path)
606 return &files.FileMetadata{}, nil
607 },
608 createFolderV2Fn: func(arg *files.CreateFolderArg) (*files.CreateFolderResult, error) {
609 createdDirs = append(createdDirs, arg.Path)
610 return &files.CreateFolderResult{}, nil
611 },
612 }
613 origNew := filesNewFunc
614 filesNewFunc = func(_ dropbox.Config) filesClient { return testClient }
615 defer func() { filesNewFunc = origNew }()
616
617 opts := putOptions{chunkSize: 1 << 24, workers: 4}
618 err := putRecursive(dir, "/empty-root", opts)
619 if err != nil {
620 t.Fatalf("putRecursive error: %v", err)
621 }
622
623 if len(uploaded) != 0 {
624 t.Fatalf("uploaded = %v, want no files", uploaded)
625 }
626 if len(createdDirs) != 1 || createdDirs[0] != "/empty-root" {
627 t.Fatalf("createdDirs = %v, want [/empty-root]", createdDirs)
628 }
629}
630
631func TestPutRecursive_SkipsSymlinks(t *testing.T) {
632 dir := t.TempDir()

Callers

nothing calls this directly

Calls 2

testConfigFunction · 0.85
putRecursiveFunction · 0.85

Tested by

no test coverage detected