MCPcopy
hub / github.com/cli/cli / TestLogoutRightAfterMigrationRemovesHost

Function TestLogoutRightAfterMigrationRemovesHost

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

Source from the content-addressed store, hash-verified

826}
827
828func TestLogoutRightAfterMigrationRemovesHost(t *testing.T) {
829 // Given we have logged in before migration
830 authCfg := newTestAuthConfig(t)
831 host := "github.com"
832 user := "test-user"
833 token := "test-token"
834
835 _, err := preMigrationLogin(authCfg, host, user, token, "ssh", false)
836 require.NoError(t, err)
837
838 // When we migrate and logout
839 var m migration.MultiAccount
840 c := cfg{authCfg.cfg}
841 require.NoError(t, c.Migrate(m))
842
843 require.NoError(t, authCfg.Logout(host, user))
844
845 // Then the host is removed from the config
846 requireNoKey(t, authCfg.cfg, []string{hostsKey, "github.com"})
847}
848
849func TestLoginInsecurePostMigrationUsesConfigForToken(t *testing.T) {
850 // 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