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

Function TestGetStdout_RejectsFolder

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

Source from the content-addressed store, hash-verified

473}
474
475func TestGetStdout_RejectsFolder(t *testing.T) {
476 mock := &mockFilesClient{
477 getMetadataFn: func(arg *files.GetMetadataArg) (files.IsMetadata, error) {
478 return &files.FolderMetadata{Metadata: files.Metadata{PathDisplay: arg.Path}}, nil
479 },
480 }
481 stubFilesClient(t, mock)
482
483 cmd := testGetCmd()
484 var stdout bytes.Buffer
485 cmd.SetOut(&stdout)
486
487 err := get(cmd, []string{"/folder", "-"})
488 if err == nil {
489 t.Fatal("expected error for folder download to stdout")
490 }
491 if !strings.Contains(err.Error(), "folder") {
492 t.Errorf("error = %q, want mention of folder", err.Error())
493 }
494 if stdout.Len() != 0 {
495 t.Errorf("stdout should be empty, got %q", stdout.String())
496 }
497}
498
499func TestGetStdout_RejectsRecursive(t *testing.T) {
500 mock := &mockFilesClient{

Callers

nothing calls this directly

Calls 4

stubFilesClientFunction · 0.85
testGetCmdFunction · 0.85
getFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected