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

Function TestMvMoveErrorIncludesAPIError

cmd/mv_test.go:58–82  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

56}
57
58func TestMvMoveErrorIncludesAPIError(t *testing.T) {
59 mock := &mockFilesClient{
60 getMetadataFn: func(arg *files.GetMetadataArg) (files.IsMetadata, error) {
61 return nil, fmt.Errorf("path/not_found/")
62 },
63 moveV2Fn: func(arg *files.RelocationArg) (*files.RelocationResult, error) {
64 return nil, fmt.Errorf("path/malformed_path/")
65 },
66 }
67 stubFilesClient(t, mock)
68
69 var err error
70 stderr := captureStderr(t, func() {
71 err = mv(mvCmd, []string{"/src/file.txt", "/dest/file.txt"})
72 })
73 if err == nil {
74 t.Fatal("expected mv error")
75 }
76 if !strings.Contains(stderr, `move "/src/file.txt" to "/dest/file.txt": path/malformed_path/`) {
77 t.Errorf("stderr = %q, want move path and API error", stderr)
78 }
79 if strings.Contains(stderr, "&{{") {
80 t.Errorf("stderr still contains formatted relocation arg: %q", stderr)
81 }
82}
83
84func TestMvJSONOutputsRelocationResults(t *testing.T) {
85 stubFilesClient(t, &mockFilesClient{

Callers

nothing calls this directly

Calls 3

stubFilesClientFunction · 0.85
captureStderrFunction · 0.85
mvFunction · 0.85

Tested by

no test coverage detected