MCPcopy
hub / github.com/cli/cli / TestTokenStoredInConfig

Function TestTokenStoredInConfig

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

Source from the content-addressed store, hash-verified

77}
78
79func TestTokenStoredInConfig(t *testing.T) {
80 // Given the user has logged in insecurely
81 authCfg := newTestAuthConfig(t)
82 _, err := authCfg.Login("github.com", "test-user", "test-token", "", false)
83 require.NoError(t, err)
84
85 // When we get the token
86 token, source := authCfg.ActiveToken("github.com")
87
88 // Then the token is successfully fetched
89 // and the source is set to oauth_token but this isn't great:
90 // https://github.com/cli/go-gh/issues/94
91 require.Equal(t, "test-token", token)
92 require.Equal(t, oauthTokenKey, source)
93}
94
95func TestTokenStoredInEnv(t *testing.T) {
96 // When the user is authenticated via env var

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