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