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

Function TestPutStdin_UploadsToDashPath

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

Source from the content-addressed store, hash-verified

184}
185
186func TestPutStdin_UploadsToDashPath(t *testing.T) {
187 content := "dash path"
188 cmd := testPutCmdWithStdin(strings.NewReader(content))
189
190 var uploadedPath string
191 mock := &mockFilesClient{
192 getMetadataFn: func(arg *files.GetMetadataArg) (files.IsMetadata, error) {
193 return nil, &files.GetMetadataAPIError{}
194 },
195 uploadFn: func(arg *files.UploadArg, r io.Reader) (*files.FileMetadata, error) {
196 uploadedPath = arg.Path
197 _, _ = io.ReadAll(r)
198 return &files.FileMetadata{}, nil
199 },
200 }
201 stubFilesClient(t, mock)
202
203 err := put(cmd, []string{"-", "/-"})
204 if err != nil {
205 t.Fatalf("put stdin error: %v", err)
206 }
207 if uploadedPath != "/-" {
208 t.Errorf("uploaded path = %q, want /-", uploadedPath)
209 }
210}
211
212func TestPutStdin_EmptyUploadsZeroBytes(t *testing.T) {
213 cmd := testPutCmdWithStdin(strings.NewReader(""))

Callers

nothing calls this directly

Calls 3

testPutCmdWithStdinFunction · 0.85
stubFilesClientFunction · 0.85
putFunction · 0.85

Tested by

no test coverage detected