(t *testing.T)
| 762 | } |
| 763 | |
| 764 | func TestLoginRefreshablePurgesNonExpiringLogin(t *testing.T) { |
| 765 | authCfg := newTestAuthConfig(t) |
| 766 | |
| 767 | // A prior non-expiring login persists a token to disk so the reload observes it. |
| 768 | _, err := authCfg.Login("github.com", "test-user", "stale-token", "ssh", false) |
| 769 | require.NoError(t, err) |
| 770 | |
| 771 | credential := gh.Credential{Token: "access", RefreshToken: "refresh"} |
| 772 | _, err = authCfg.LoginRefreshable("github.com", "test-user", credential, "ssh", false) |
| 773 | require.NoError(t, err) |
| 774 | |
| 775 | // The stale non-expiring token is gone and the refreshable credential resolves instead. |
| 776 | requireNoKey(t, authCfg.cfg, []string{hostsKey, "github.com", usersKey, "test-user", oauthTokenKey}) |
| 777 | cred, err := authCfg.TokenForUser("github.com", "test-user") |
| 778 | require.NoError(t, err) |
| 779 | require.Equal(t, "access", cred.Token) |
| 780 | } |
| 781 | |
| 782 | // TestLoginRefreshablePurgesNonExpiringKeyringLogin covers the keyring arm of the non-expiring purge. Resolution now |
| 783 | // probes the ordinary keyring before the refreshable credential, so a stale per-user keyring token left behind would |
nothing calls this directly
no test coverage detected