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

Function TestLoginPostMigrationSetsUser

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

Source from the content-addressed store, hash-verified

933}
934
935func TestLoginPostMigrationSetsUser(t *testing.T) {
936 // Given we have logged in after migration
937 authCfg := newTestAuthConfig(t)
938
939 var m migration.MultiAccountDeprecated
940 c := cfg{cfg: authCfg.cfg}
941 require.NoError(t, c.Migrate(m))
942
943 _, err := authCfg.Login("github.com", "test-user", "test-token", "ssh", false)
944 require.NoError(t, err)
945
946 // When we get the user
947 user, err := authCfg.ActiveUser("github.com")
948
949 // Then it returns success and the user we provided on login
950 require.NoError(t, err)
951 require.Equal(t, "test-user", user)
952}
953
954func TestLoginSecurePostMigrationRemovesTokenFromConfig(t *testing.T) {
955 // Given we have logged in insecurely

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected