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

Function TestLoginPostMigrationSetsUser

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

Source from the content-addressed store, hash-verified

887}
888
889func TestLoginPostMigrationSetsUser(t *testing.T) {
890 // Given we have logged in after migration
891 authCfg := newTestAuthConfig(t)
892
893 var m migration.MultiAccount
894 c := cfg{authCfg.cfg}
895 require.NoError(t, c.Migrate(m))
896
897 _, err := authCfg.Login("github.com", "test-user", "test-token", "ssh", false)
898 require.NoError(t, err)
899
900 // When we get the user
901 user, err := authCfg.ActiveUser("github.com")
902
903 // Then it returns success and the user we provided on login
904 require.NoError(t, err)
905 require.Equal(t, "test-user", user)
906}
907
908func TestLoginSecurePostMigrationRemovesTokenFromConfig(t *testing.T) {
909 // 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