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

Function TestRevsUsesListRevisionsAndCommandOutput

cmd/revs_test.go:74–102  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

72}
73
74func TestRevsUsesListRevisionsAndCommandOutput(t *testing.T) {
75 cmd, stdout := testRevsCmd()
76 var gotPath string
77 var gotLimit uint64
78
79 stubFilesClient(t, &mockFilesClient{
80 listRevisionsFn: func(arg *files.ListRevisionsArg) (*files.ListRevisionsResult, error) {
81 gotPath = arg.Path
82 gotLimit = arg.Limit
83 return files.NewListRevisionsResult(false, []*files.FileMetadata{
84 {Rev: "rev-c"},
85 }, false), nil
86 },
87 })
88
89 if err := revs(cmd, []string{"/report.pdf"}); err != nil {
90 t.Fatalf("revs returned error: %v", err)
91 }
92
93 if gotPath != "/report.pdf" {
94 t.Fatalf("ListRevisions path = %q, want %q", gotPath, "/report.pdf")
95 }
96 if gotLimit != 10 {
97 t.Fatalf("ListRevisions limit = %d, want SDK default 10", gotLimit)
98 }
99 if got, want := stdout.String(), "rev-c\n"; got != want {
100 t.Fatalf("stdout = %q, want %q", got, want)
101 }
102}
103
104func TestRevsJSONOutputsInputAndResults(t *testing.T) {
105 cmd, stdout := testRevsCmd()

Callers

nothing calls this directly

Calls 3

testRevsCmdFunction · 0.85
stubFilesClientFunction · 0.85
revsFunction · 0.85

Tested by

no test coverage detected