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

Function TestTokenForUserInsecureLogin

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

Source from the content-addressed store, hash-verified

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