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

Function setupLegacyUnkeyedKeyringState

pkg/cmd/auth/token/token_test.go:498–503  ·  view source on GitHub ↗

setupLegacyUnkeyedKeyringState recreates the state a very old gh install leaves behind: an active user is recorded for github.com, but the only keyring token lives in the legacy unkeyed slot rather than a per-user slot. It logs in to record the active user, deletes the per-user keyring slot that log

(t *testing.T, c gh.Config)

Source from the content-addressed store, hash-verified

496// to record the active user, deletes the per-user keyring slot that login writes, and sets the unkeyed slot. The
497// keyring service name mirrors config.keyringServiceName, which is unexported.
498func setupLegacyUnkeyedKeyringState(t *testing.T, c gh.Config) {
499 t.Helper()
500 login(t, c, "github.com", "test-user", "gho_PERUSER", "https", true)
501 require.NoError(t, keyring.Delete("gh:github.com", "test-user"))
502 require.NoError(t, keyring.Set("gh:github.com", "", "gho_LEGACY"))
503}
504
505func loginRefreshable(t *testing.T, c gh.Config, hostname, username, accessToken, refreshToken string, secureStorage bool) {
506 t.Helper()

Callers 1

Calls 4

DeleteFunction · 0.92
SetFunction · 0.92
loginFunction · 0.70
HelperMethod · 0.65

Tested by

no test coverage detected