(t *testing.T)
| 601 | } |
| 602 | |
| 603 | func TestLoginRefreshablePurgesNonExpiringLogin(t *testing.T) { |
| 604 | authCfg := newTestAuthConfig(t) |
| 605 | |
| 606 | // A prior non-expiring login persists a token to disk so the reload observes it. |
| 607 | _, err := authCfg.Login("github.com", "test-user", "stale-token", "ssh", false) |
| 608 | require.NoError(t, err) |
| 609 | |
| 610 | credential := gh.Credential{Token: "access", RefreshToken: "refresh"} |
| 611 | _, err = authCfg.LoginRefreshable("github.com", "test-user", credential, "ssh", false) |
| 612 | require.NoError(t, err) |
| 613 | |
| 614 | // The stale non-expiring token is gone and the refreshable credential resolves instead. |
| 615 | requireNoKey(t, authCfg.cfg, []string{hostsKey, "github.com", usersKey, "test-user", oauthTokenKey}) |
| 616 | cred, err := authCfg.TokenForUser("github.com", "test-user") |
| 617 | require.NoError(t, err) |
| 618 | require.Equal(t, "access", cred.Token) |
| 619 | } |
| 620 | |
| 621 | // TestLoginRefreshablePurgesNonExpiringKeyringLogin covers the keyring arm of the non-expiring purge. Resolution now |
| 622 | // 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