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

Function TestLogoutRightAfterMigrationRemovesHost

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

Source from the content-addressed store, hash-verified

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