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

Function TestUserWorksRightAfterMigration

internal/config/auth_config_test.go:689–704  ·  view source on GitHub ↗

Post migration tests

(t *testing.T)

Source from the content-addressed store, hash-verified

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