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

Function renewingRefresher

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

renewingRefresher returns a mock that renews to a fresh, long lived credential and records its calls.

(accessToken, refreshToken string)

Source from the content-addressed store, hash-verified

525
526// renewingRefresher returns a mock that renews to a fresh, long lived credential and records its calls.
527func renewingRefresher(accessToken, refreshToken string) *ghmock.TokenRefresherMock {
528 return &ghmock.TokenRefresherMock{
529 RefreshFunc: func(_ string, _ string) (gh.RefreshableCredential, error) {
530 future := time.Now().Add(time.Hour)
531 return gh.RefreshableCredential{
532 AccessToken: accessToken,
533 RefreshToken: refreshToken,
534 ExpiresAt: &future,
535 }, nil
536 },
537 }
538}
539
540// failingRefresher returns a mock that always fails to refresh and records its calls.
541func failingRefresher() *ghmock.TokenRefresherMock {

Callers 1

TestTokenRunRefreshFunction · 0.70

Calls 1

AddMethod · 0.65

Tested by

no test coverage detected