(t *testing.T)
| 214 | } |
| 215 | |
| 216 | func TestValidateRefreshableCredential(t *testing.T) { |
| 217 | tests := []struct { |
| 218 | name string |
| 219 | cred gh.Credential |
| 220 | wantErr bool |
| 221 | }{ |
| 222 | { |
| 223 | name: "missing access token", |
| 224 | cred: gh.Credential{RefreshToken: "refresh"}, |
| 225 | wantErr: true, |
| 226 | }, |
| 227 | { |
| 228 | name: "missing refresh token", |
| 229 | cred: gh.Credential{Token: "access"}, |
| 230 | wantErr: true, |
| 231 | }, |
| 232 | { |
| 233 | name: "valid", |
| 234 | cred: gh.Credential{Token: "access", RefreshToken: "refresh"}, |
| 235 | wantErr: false, |
| 236 | }, |
| 237 | } |
| 238 | for _, tt := range tests { |
| 239 | t.Run(tt.name, func(t *testing.T) { |
| 240 | err := validateRefreshableCredential(tt.cred) |
| 241 | if tt.wantErr { |
| 242 | require.Error(t, err) |
| 243 | return |
| 244 | } |
| 245 | require.NoError(t, err) |
| 246 | }) |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | func TestSetActiveCredential(t *testing.T) { |
| 251 | tests := []struct { |
nothing calls this directly
no test coverage detected