MCPcopy Index your code
hub / github.com/cli/cli / TestLoginPostMigrationSetsUser

Function TestLoginPostMigrationSetsUser

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

Source from the content-addressed store, hash-verified

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