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

Function TestTokenStoredInEnv

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

Source from the content-addressed store, hash-verified

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