MCPcopy Index your code
hub / github.com/apache/devlake / fakeRefreshFn

Function fakeRefreshFn

backend/plugins/github/token/token_provider_test.go:147–154  ·  view source on GitHub ↗

fakeRefreshFn returns a refreshFn that updates the connection token to newToken and increments the call counter pointed to by count.

(newToken string, count *int)

Source from the content-addressed store, hash-verified

145// fakeRefreshFn returns a refreshFn that updates the connection token to newToken
146// and increments the call counter pointed to by count.
147func fakeRefreshFn(newToken string, count *int) func(*TokenProvider) errors.Error {
148 return func(tp *TokenProvider) errors.Error {
149 *count++
150 newExpiry := time.Now().Add(1 * time.Hour)
151 tp.conn.UpdateToken(newToken, "", &newExpiry, nil)
152 return nil
153 }
154}
155
156func TestNeedsRefreshWithRefreshFn(t *testing.T) {
157 callCount := 0

Callers 3

TestAppKeyForceRefreshFunction · 0.85

Calls 2

UpdateTokenMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected