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

Function renewingRefresher

pkg/cmd/auth/refresh/refresh_test.go:1028–1039  ·  view source on GitHub ↗

renewingRefresher renews any refresh token to a fresh, long-lived credential whose access token is "new-access".

()

Source from the content-addressed store, hash-verified

1026
1027// renewingRefresher renews any refresh token to a fresh, long-lived credential whose access token is "new-access".
1028func renewingRefresher() *ghmock.TokenRefresherMock {
1029 future := time.Now().Add(time.Hour)
1030 return &ghmock.TokenRefresherMock{
1031 RefreshFunc: func(_, _ string) (gh.RefreshableCredential, error) {
1032 return gh.RefreshableCredential{
1033 AccessToken: "new-access",
1034 RefreshToken: "new-refresh",
1035 ExpiresAt: &future,
1036 }, nil
1037 },
1038 }
1039}
1040
1041// failingRefresher always fails to renew, simulating a transient refresh error.
1042func failingRefresher() *ghmock.TokenRefresherMock {

Callers 1

Test_refreshRunFunction · 0.70

Calls 1

AddMethod · 0.65

Tested by

no test coverage detected