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

Function TestTokenStoredInKeyring

internal/config/auth_config_test.go:110–123  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

108}
109
110func TestTokenStoredInKeyring(t *testing.T) {
111 // When the user has logged in securely
112 authCfg := newTestAuthConfig(t)
113 _, err := authCfg.Login("github.com", "test-user", "test-token", "", true)
114 require.NoError(t, err)
115
116 // When we get the token
117 token, source := authCfg.ActiveToken("github.com")
118
119 // Then the token is successfully fetched
120 // and the source is set to keyring
121 require.Equal(t, "test-token", token)
122 require.Equal(t, "keyring", source)
123}
124
125func TestTokenFromKeyringNonExistent(t *testing.T) {
126 // Given a keyring that doesn't contain any tokens

Callers

nothing calls this directly

Calls 4

newTestAuthConfigFunction · 0.85
EqualMethod · 0.80
LoginMethod · 0.65
ActiveTokenMethod · 0.65

Tested by

no test coverage detected