MCPcopy Create free account
hub / github.com/cli/cli / expiredRefresher

Function expiredRefresher

pkg/cmd/auth/token/token_test.go:551–557  ·  view source on GitHub ↗

expiredRefresher returns a mock whose refresh token is rejected by the server, recorded via gh.ErrRefreshTokenInvalid, and records its calls.

()

Source from the content-addressed store, hash-verified

549// expiredRefresher returns a mock whose refresh token is rejected by the server, recorded via
550// gh.ErrRefreshTokenInvalid, and records its calls.
551func expiredRefresher() *ghmock.TokenRefresherMock {
552 return &ghmock.TokenRefresherMock{
553 RefreshFunc: func(_ string, _ string) (gh.RefreshableCredential, error) {
554 return gh.RefreshableCredential{}, fmt.Errorf("server rejected token: %w", gh.ErrRefreshTokenInvalid)
555 },
556 }
557}
558
559func TestTokenRunRefresh(t *testing.T) {
560 // past and future are relative to the 10 minute refresh leeway: past tokens (or those with no recorded expiry)

Callers 1

TestTokenRunRefreshFunction · 0.85

Calls 1

ErrorfMethod · 0.65

Tested by

no test coverage detected