(t *testing.T)
| 156 | } |
| 157 | |
| 158 | func TestAccountJSONErrorWritesNoOutput(t *testing.T) { |
| 159 | cmd, stdout := testAccountCmd() |
| 160 | setAccountOutputJSON(t, cmd) |
| 161 | stubUsersClient(t, &mockUsersClient{ |
| 162 | getCurrentAccountFn: func() (*users.FullAccount, error) { |
| 163 | return nil, errors.New("account failed") |
| 164 | }, |
| 165 | }) |
| 166 | |
| 167 | if err := account(cmd, nil); err == nil { |
| 168 | t.Fatal("expected account error") |
| 169 | } |
| 170 | if got := stdout.String(); got != "" { |
| 171 | t.Fatalf("stdout = %q, want empty output on error", got) |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | func TestAccountCommandSupportsStructuredOutput(t *testing.T) { |
| 176 | if !commandSupportsStructuredOutput(accountCmd) { |
nothing calls this directly
no test coverage detected