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

Function TestDefaultHostWorksRightAfterMigration

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

Source from the content-addressed store, hash-verified

736}
737
738func TestDefaultHostWorksRightAfterMigration(t *testing.T) {
739 // Given we have logged in before migration to an enterprise host
740 authCfg := newTestAuthConfig(t)
741 _, err := preMigrationLogin(authCfg, "ghe.io", "test-user", "test-token", "ssh", false)
742 require.NoError(t, err)
743
744 // When we migrate
745 var m migration.MultiAccount
746 c := cfg{authCfg.cfg}
747 require.NoError(t, c.Migrate(m))
748
749 // Then the default host is still the enterprise host
750 defaultHost, source := authCfg.DefaultHost()
751 require.Equal(t, "ghe.io", defaultHost)
752 require.Equal(t, hostsKey, source)
753}
754
755func TestTokenWorksRightAfterMigration(t *testing.T) {
756 // Given we have logged in before migration

Callers

nothing calls this directly

Calls 5

MigrateMethod · 0.95
newTestAuthConfigFunction · 0.85
preMigrationLoginFunction · 0.85
EqualMethod · 0.80
DefaultHostMethod · 0.65

Tested by

no test coverage detected