MCPcopy Index your code
hub / github.com/cli/cli / TestTokenStoredInKeyring

Function TestTokenStoredInKeyring

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

Source from the content-addressed store, hash-verified

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