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

Function TestTokenStoredInEnv

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

Source from the content-addressed store, hash-verified

94}
95
96func TestTokenStoredInEnv(t *testing.T) {
97 // When the user is authenticated via env var
98 authCfg := newTestAuthConfig(t)
99 t.Setenv("GH_TOKEN", "test-token")
100
101 // When we get the token
102 token, source := authCfg.ActiveToken("github.com")
103
104 // Then the token is successfully fetched
105 // and the source is set to the name of the env var
106 require.Equal(t, "test-token", token)
107 require.Equal(t, "GH_TOKEN", source)
108}
109
110func TestTokenStoredInKeyring(t *testing.T) {
111 // 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