(t *testing.T)
| 424 | } |
| 425 | |
| 426 | func TestLogoutOfInactiveUserDoesNotSwitchUser(t *testing.T) { |
| 427 | // Given we have two accounts logged into a host |
| 428 | authCfg := newTestAuthConfig(t) |
| 429 | _, err := authCfg.Login("github.com", "inactive-user-1", "test-token-1.1", "ssh", true) |
| 430 | require.NoError(t, err) |
| 431 | |
| 432 | _, err = authCfg.Login("github.com", "inactive-user-2", "test-token-1.2", "ssh", true) |
| 433 | require.NoError(t, err) |
| 434 | |
| 435 | _, err = authCfg.Login("github.com", "active-user", "test-token-2", "https", true) |
| 436 | require.NoError(t, err) |
| 437 | |
| 438 | // When we logout of an inactive user |
| 439 | err = authCfg.Logout("github.com", "inactive-user-1") |
| 440 | |
| 441 | // Then we return success and the active user is still active |
| 442 | require.NoError(t, err) |
| 443 | activeUser, err := authCfg.ActiveUser("github.com") |
| 444 | require.NoError(t, err) |
| 445 | require.Equal(t, "active-user", activeUser) |
| 446 | } |
| 447 | |
| 448 | // Note that I'm not sure this test enforces particularly desirable behaviour |
| 449 | // since it leads users to believe a token has been removed when really |
nothing calls this directly
no test coverage detected