(t *testing.T)
| 113 | } |
| 114 | |
| 115 | func TestTokenRefresherRefreshRejected(t *testing.T) { |
| 116 | stub := &stubRoundTripper{ |
| 117 | body: "error=bad_refresh_token&error_description=The+refresh+token+passed+is+incorrect+or+expired.", |
| 118 | } |
| 119 | refresher := NewTokenRefresher(&http.Client{Transport: stub}) |
| 120 | |
| 121 | _, err := refresher.Refresh("ghr_OLD", "github.com") |
| 122 | require.Error(t, err) |
| 123 | // The gh sentinel lets a caller classify an unusable refresh token without importing the OAuth library, while the |
| 124 | // original library error is preserved in the chain. |
| 125 | require.ErrorIs(t, err, gh.ErrRefreshTokenInvalid) |
| 126 | require.ErrorIs(t, err, oauth.ErrRefreshTokenInvalid) |
| 127 | } |
| 128 | |
| 129 | func TestAuthResultFromToken(t *testing.T) { |
| 130 | // Production anchors the lifetime at timeNow().UTC(), so mirror that with a UTC anchor here. |
nothing calls this directly
no test coverage detected