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

Function TestLogoutRightAfterMigrationRemovesHost

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

Source from the content-addressed store, hash-verified

873}
874
875func TestLogoutRightAfterMigrationRemovesHost(t *testing.T) {
876 // Given we have logged in before migration
877 authCfg := newTestAuthConfig(t)
878 host := "github.com"
879 user := "test-user"
880 token := "test-token"
881
882 _, err := preMigrationLogin(authCfg, host, user, token, "ssh", false)
883 require.NoError(t, err)
884
885 // When we migrate and logout
886 var m migration.MultiAccountDeprecated
887 c := cfg{cfg: authCfg.cfg}
888 require.NoError(t, c.Migrate(m))
889
890 require.NoError(t, authCfg.Logout(host, user))
891
892 // Then the host is removed from the config
893 requireNoKey(t, authCfg.cfg, []string{hostsKey, "github.com"})
894}
895
896func TestLoginInsecurePostMigrationUsesConfigForToken(t *testing.T) {
897 // Given we have not logged in

Callers

nothing calls this directly

Calls 5

MigrateMethod · 0.95
newTestAuthConfigFunction · 0.85
preMigrationLoginFunction · 0.85
requireNoKeyFunction · 0.70
LogoutMethod · 0.65

Tested by

no test coverage detected