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

Function TestPutRecursive_SkipsSymlinks

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

Source from the content-addressed store, hash-verified

629}
630
631func TestPutRecursive_SkipsSymlinks(t *testing.T) {
632 dir := t.TempDir()
633 if err := os.WriteFile(filepath.Join(dir, "real.txt"), []byte("real"), 0644); err != nil {
634 t.Fatal(err)
635 }
636 if err := os.Symlink(filepath.Join(dir, "real.txt"), filepath.Join(dir, "link.txt")); err != nil {
637 t.Fatal(err)
638 }
639
640 var uploaded []string
641 origConfig := config
642 defer func() { config = origConfig }()
643
644 config = testConfig()
645 testClient := &mockFilesClient{
646 uploadFn: func(arg *files.UploadArg, content io.Reader) (*files.FileMetadata, error) {
647 uploaded = append(uploaded, arg.Path)
648 return &files.FileMetadata{}, nil
649 },
650 }
651 origNew := filesNewFunc
652 filesNewFunc = func(_ dropbox.Config) filesClient { return testClient }
653 defer func() { filesNewFunc = origNew }()
654
655 opts := putOptions{chunkSize: 1 << 24, workers: 4}
656 err := putRecursive(dir, "/dest", opts)
657 if err != nil {
658 t.Fatalf("putRecursive error: %v", err)
659 }
660
661 if len(uploaded) != 1 {
662 t.Fatalf("uploaded %d files, want 1: %v", len(uploaded), uploaded)
663 }
664 if uploaded[0] != "/dest/real.txt" {
665 t.Errorf("uploaded[0] = %q, want /dest/real.txt", uploaded[0])
666 }
667}
668
669func TestPutChunkSizeValidation(t *testing.T) {
670 tests := []struct {

Callers

nothing calls this directly

Calls 2

testConfigFunction · 0.85
putRecursiveFunction · 0.85

Tested by

no test coverage detected