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

Function TestDuJSONErrorWritesNoOutput

cmd/du_test.go:109–124  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

107}
108
109func TestDuJSONErrorWritesNoOutput(t *testing.T) {
110 cmd, stdout := testDuCmd()
111 setDuOutputJSON(t, cmd)
112 stubUsersClient(t, &mockUsersClient{
113 getSpaceUsageFn: func() (*users.SpaceUsage, error) {
114 return nil, errors.New("du failed")
115 },
116 })
117
118 if err := du(cmd, nil); err == nil {
119 t.Fatal("expected du error")
120 }
121 if got := stdout.String(); got != "" {
122 t.Fatalf("stdout = %q, want empty output on error", got)
123 }
124}
125
126func TestDuCommandSupportsStructuredOutput(t *testing.T) {
127 if !commandSupportsStructuredOutput(duCmd) {

Callers

nothing calls this directly

Calls 4

testDuCmdFunction · 0.85
setDuOutputJSONFunction · 0.85
stubUsersClientFunction · 0.85
duFunction · 0.85

Tested by

no test coverage detected