(t *testing.T)
| 131 | } |
| 132 | |
| 133 | func TestAccountLookupTextIncludesAuth(t *testing.T) { |
| 134 | cmd, stdout := testAccountCmd() |
| 135 | setCurrentAuthContextForTest(t, &authContext{Source: authSourceEnv, Refreshable: false, AuthFile: authFileNone}) |
| 136 | stubUsersClient(t, &mockUsersClient{ |
| 137 | getAccountFn: func(arg *users.GetAccountArg) (*users.BasicAccount, error) { |
| 138 | return testBasicAccount(), nil |
| 139 | }, |
| 140 | }) |
| 141 | |
| 142 | if err := account(cmd, []string{"dbid:lookup"}); err != nil { |
| 143 | t.Fatalf("account returned error: %v", err) |
| 144 | } |
| 145 | |
| 146 | output := stdout.String() |
| 147 | if !strings.Contains(output, "Auth:") || !strings.Contains(output, "Source: DBXCLI_ACCESS_TOKEN") || !strings.Contains(output, "Refreshable: false") || !strings.Contains(output, "Auth File: none") { |
| 148 | t.Fatalf("stdout = %q, want env auth context", output) |
| 149 | } |
| 150 | if strings.Contains(output, "Profile Photo URL:") { |
| 151 | t.Fatalf("stdout = %q, want empty profile photo omitted", output) |
| 152 | } |
| 153 | if strings.Contains(output, "Acting As:") { |
| 154 | t.Fatalf("stdout = %q, want no Acting As section", output) |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | func TestAccountJSONErrorWritesNoOutput(t *testing.T) { |
| 159 | cmd, stdout := testAccountCmd() |
nothing calls this directly
no test coverage detected