(t *testing.T)
| 408 | } |
| 409 | |
| 410 | func TestLogoutOfInactiveUserDoesNotSwitchUser(t *testing.T) { |
| 411 | // Given we have two accounts logged into a host |
| 412 | authCfg := newTestAuthConfig(t) |
| 413 | _, err := authCfg.Login("github.com", "inactive-user-1", "test-token-1.1", "ssh", true) |
| 414 | require.NoError(t, err) |
| 415 | |
| 416 | _, err = authCfg.Login("github.com", "inactive-user-2", "test-token-1.2", "ssh", true) |
| 417 | require.NoError(t, err) |
| 418 | |
| 419 | _, err = authCfg.Login("github.com", "active-user", "test-token-2", "https", true) |
| 420 | require.NoError(t, err) |
| 421 | |
| 422 | // When we logout of an inactive user |
| 423 | err = authCfg.Logout("github.com", "inactive-user-1") |
| 424 | |
| 425 | // Then we return success and the active user is still active |
| 426 | require.NoError(t, err) |
| 427 | activeUser, err := authCfg.ActiveUser("github.com") |
| 428 | require.NoError(t, err) |
| 429 | require.Equal(t, "active-user", activeUser) |
| 430 | } |
| 431 | |
| 432 | // Note that I'm not sure this test enforces particularly desirable behaviour |
| 433 | // since it leads users to believe a token has been removed when really |
nothing calls this directly
no test coverage detected