MCPcopy
hub / github.com/cli/cli / TestUserWorksRightAfterMigration

Function TestUserWorksRightAfterMigration

internal/config/auth_config_test.go:688–703  ·  view source on GitHub ↗

Post migration tests

(t *testing.T)

Source from the content-addressed store, hash-verified

686// Post migration tests
687
688func TestUserWorksRightAfterMigration(t *testing.T) {
689 // Given we have logged in before migration
690 authCfg := newTestAuthConfig(t)
691 _, err := preMigrationLogin(authCfg, "github.com", "test-user", "test-token", "ssh", false)
692 require.NoError(t, err)
693
694 // When we migrate
695 var m migration.MultiAccount
696 c := cfg{authCfg.cfg}
697 require.NoError(t, c.Migrate(m))
698
699 // Then we can still get the user correctly
700 user, err := authCfg.ActiveUser("github.com")
701 require.NoError(t, err)
702 require.Equal(t, "test-user", user)
703}
704
705func TestGitProtocolWorksRightAfterMigration(t *testing.T) {
706 // Given we have logged in before migration with a non-default git protocol

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected