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

Function TestPutStdin_RejectsExistingFolder

cmd/pipe_test.go:66–83  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

64}
65
66func TestPutStdin_RejectsExistingFolder(t *testing.T) {
67 cmd := testPutCmdWithStdin(strings.NewReader("data"))
68
69 mock := &mockFilesClient{
70 getMetadataFn: func(arg *files.GetMetadataArg) (files.IsMetadata, error) {
71 return &files.FolderMetadata{Metadata: files.Metadata{PathDisplay: arg.Path}}, nil
72 },
73 }
74 stubFilesClient(t, mock)
75
76 err := put(cmd, []string{"-", "/existing-folder"})
77 if err == nil {
78 t.Fatal("expected error for existing folder target")
79 }
80 if !strings.Contains(err.Error(), "folder") {
81 t.Errorf("error = %q, want mention of folder", err.Error())
82 }
83}
84
85func TestPutStdin_UploadsContent(t *testing.T) {
86 content := "hello from stdin"

Callers

nothing calls this directly

Calls 4

testPutCmdWithStdinFunction · 0.85
stubFilesClientFunction · 0.85
putFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected