(t *testing.T)
| 485 | } |
| 486 | |
| 487 | func TestSwitchUserUpdatesTheActiveUser(t *testing.T) { |
| 488 | // Given we have two users logged into a host |
| 489 | authCfg := newTestAuthConfig(t) |
| 490 | _, err := authCfg.Login("github.com", "test-user-1", "test-token-1", "ssh", false) |
| 491 | require.NoError(t, err) |
| 492 | _, err = authCfg.Login("github.com", "test-user-2", "test-token-2", "ssh", false) |
| 493 | require.NoError(t, err) |
| 494 | |
| 495 | // When we switch to the other user |
| 496 | require.NoError(t, authCfg.SwitchUser("github.com", "test-user-1")) |
| 497 | |
| 498 | // Then the active user is updated |
| 499 | activeUser, err := authCfg.ActiveUser("github.com") |
| 500 | require.NoError(t, err) |
| 501 | require.Equal(t, "test-user-1", activeUser) |
| 502 | } |
| 503 | |
| 504 | func TestSwitchUserErrorsImmediatelyIfTheActiveTokenComesFromEnvironment(t *testing.T) { |
| 505 | // Given we have a token in the env |
nothing calls this directly
no test coverage detected