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

Function TestLoginPostMigrationSetsUser

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

Source from the content-addressed store, hash-verified

935}
936
937func TestLoginPostMigrationSetsUser(t *testing.T) {
938 // Given we have logged in after migration
939 authCfg := newTestAuthConfig(t)
940
941 var m migration.MultiAccountDeprecated
942 c := cfg{cfg: authCfg.cfg}
943 require.NoError(t, c.Migrate(m))
944
945 _, err := authCfg.Login("github.com", "test-user", "test-token", "ssh", false)
946 require.NoError(t, err)
947
948 // When we get the user
949 user, err := authCfg.ActiveUser("github.com")
950
951 // Then it returns success and the user we provided on login
952 require.NoError(t, err)
953 require.Equal(t, "test-user", user)
954}
955
956func TestLoginSecurePostMigrationRemovesTokenFromConfig(t *testing.T) {
957 // Given we have logged in insecurely

Callers

nothing calls this directly

Calls 5

MigrateMethod · 0.95
newTestAuthConfigFunction · 0.85
EqualMethod · 0.80
LoginMethod · 0.65
ActiveUserMethod · 0.65

Tested by

no test coverage detected