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

Function TestRequestAccessTokenReturnsReadError

cmd/auth_test.go:575–596  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

573}
574
575func 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
598func TestRequestAccessTokenUsesDefaultTeamManageAppKey(t *testing.T) {
599 restoreOAuthCredentials(t)

Callers

nothing calls this directly

Calls 2

mockOAuthAppCredentialsFunction · 0.85
requestAccessTokenFunction · 0.85

Tested by

no test coverage detected