(t *testing.T)
| 573 | } |
| 574 | |
| 575 | func TestRequestAccessTokenReturnsReadError(t *testing.T) { |
| 576 | mockOAuthAppCredentials(t) |
| 577 | |
| 578 | origReadAuthorizationCode := readAuthorizationCode |
| 579 | origExchangeAuthorizationCode := exchangeAuthorizationCode |
| 580 | t.Cleanup(func() { |
| 581 | readAuthorizationCode = origReadAuthorizationCode |
| 582 | exchangeAuthorizationCode = origExchangeAuthorizationCode |
| 583 | }) |
| 584 | |
| 585 | readAuthorizationCode = func() (string, error) { |
| 586 | return "", errors.New("read failed") |
| 587 | } |
| 588 | exchangeAuthorizationCode = func(ctx context.Context, conf *oauth2.Config, code string, verifier string) (*oauth2.Token, error) { |
| 589 | t.Fatal("authorization exchange should not run when reading code fails") |
| 590 | return nil, nil |
| 591 | } |
| 592 | |
| 593 | if _, err := requestAccessToken(tokenPersonal, ""); err == nil { |
| 594 | t.Fatal("expected authorization code read error") |
| 595 | } |
| 596 | } |
| 597 | |
| 598 | func TestRequestAccessTokenUsesDefaultTeamManageAppKey(t *testing.T) { |
| 599 | restoreOAuthCredentials(t) |
nothing calls this directly
no test coverage detected