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