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

Function TestTokenForUserInsecureLogin

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

Source from the content-addressed store, hash-verified

660}
661
662func TestTokenForUserInsecureLogin(t *testing.T) {
663 // Given a user has logged in insecurely
664 authCfg := newTestAuthConfig(t)
665 _, err := authCfg.Login("github.com", "test-user-1", "test-token", "ssh", false)
666 require.NoError(t, err)
667
668 // When we get the token
669 cred, err := authCfg.TokenForUser("github.com", "test-user-1")
670
671 // Then it returns the token and the source as oauth_token
672 require.NoError(t, err)
673 require.Equal(t, "test-token", cred.Token)
674 require.Equal(t, "oauth_token", cred.Source)
675}
676
677func TestTokenForUserNotFoundErrors(t *testing.T) {
678 // Given a user has not logged in

Callers

nothing calls this directly

Calls 4

newTestAuthConfigFunction · 0.85
EqualMethod · 0.80
LoginMethod · 0.65
TokenForUserMethod · 0.65

Tested by

no test coverage detected