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

Function TestMvJSONMultipleSourcesOutputsMultipleResults

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

Source from the content-addressed store, hash-verified

118}
119
120func TestMvJSONMultipleSourcesOutputsMultipleResults(t *testing.T) {
121 stubFilesClient(t, &mockFilesClient{
122 moveV2Fn: func(arg *files.RelocationArg) (*files.RelocationResult, error) {
123 name := path.Base(arg.ToPath)
124 metadata := files.NewFileMetadata(name, "id:"+name, dropbox.DBXTime(time.Time{}), dropbox.DBXTime(time.Time{}), "rev", 1)
125 metadata.PathDisplay = arg.ToPath
126 metadata.PathLower = strings.ToLower(arg.ToPath)
127 return files.NewRelocationResult(metadata), nil
128 },
129 })
130
131 var stdout bytes.Buffer
132 cmd := newRelocationTestCommand(&stdout, nil)
133
134 if err := mv(cmd, []string{"/src/a.txt", "/src/b.txt", "/dest"}); err != nil {
135 t.Fatalf("mv error: %v", err)
136 }
137
138 got := decodeRelocationOutput(t, stdout.Bytes())
139 if len(got.Results) != 2 {
140 t.Fatalf("results = %d, want 2", len(got.Results))
141 }
142 if got.Results[0].Input.ToPath != "/dest/a.txt" || got.Results[1].Input.ToPath != "/dest/b.txt" {
143 t.Fatalf("results = %#v, want folder destinations", got.Results)
144 }
145}
146
147func TestMvJSONErrorUsesCommandStderr(t *testing.T) {
148 stubFilesClient(t, &mockFilesClient{

Callers

nothing calls this directly

Calls 4

stubFilesClientFunction · 0.85
newRelocationTestCommandFunction · 0.85
mvFunction · 0.85
decodeRelocationOutputFunction · 0.85

Tested by

no test coverage detected