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

Function TestTokenForUserInsecureLogin

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

Source from the content-addressed store, hash-verified

642}
643
644func TestTokenForUserInsecureLogin(t *testing.T) {
645 // Given a user has logged in insecurely
646 authCfg := newTestAuthConfig(t)
647 _, err := authCfg.Login("github.com", "test-user-1", "test-token", "ssh", false)
648 require.NoError(t, err)
649
650 // When we get the token
651 token, source, err := authCfg.TokenForUser("github.com", "test-user-1")
652
653 // Then it returns the token and the source as oauth_token
654 require.NoError(t, err)
655 require.Equal(t, "test-token", token)
656 require.Equal(t, "oauth_token", source)
657}
658
659func TestTokenForUserNotFoundErrors(t *testing.T) {
660 // 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