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

Function TestTokenStoredInConfig

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

Source from the content-addressed store, hash-verified

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