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

Function TestTokenStoredInEnv

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 TestTokenStoredInEnv(t *testing.T) {
110 // When the user is authenticated via env var
111 authCfg := newTestAuthConfig(t)
112 t.Setenv("GH_TOKEN", "test-token")
113
114 // When we get the token
115 cred := authCfg.ActiveToken("github.com")
116 token, source := cred.Token, cred.Source
117
118 // Then the token is successfully fetched
119 // and the source is set to the name of the env var
120 require.Equal(t, "test-token", token)
121 require.Equal(t, "GH_TOKEN", source)
122}
123
124func TestTokenStoredInKeyring(t *testing.T) {
125 // When the user has logged in securely

Callers

nothing calls this directly

Calls 3

newTestAuthConfigFunction · 0.85
EqualMethod · 0.80
ActiveTokenMethod · 0.65

Tested by

no test coverage detected