MCPcopy Index your code
hub / github.com/cli/cli / TestLogoutIgnoresErrorsFromConfigAndKeyring

Function TestLogoutIgnoresErrorsFromConfigAndKeyring

internal/config/auth_config_test.go:439–450  ·  view source on GitHub ↗

Note that I'm not sure this test enforces particularly desirable behaviour since it leads users to believe a token has been removed when really that might have failed for some reason. The original intention here is that if the logout fails, the user can't really do anything to recover. On the other

(t *testing.T)

Source from the content-addressed store, hash-verified

437// really do anything to recover. On the other hand, a user might
438// want to rectify this manually, for example if there were on a shared machine.
439func TestLogoutIgnoresErrorsFromConfigAndKeyring(t *testing.T) {
440 // Given we have keyring that errors, and a config that
441 // doesn't even have a hosts key (which would cause Remove to fail)
442 keyring.MockInitWithError(errors.New("test-explosion"))
443 authCfg := newTestAuthConfig(t)
444
445 // When we logout
446 err := authCfg.Logout("github.com", "test-user")
447
448 // Then it returns success anyway, suppressing the errors
449 require.NoError(t, err)
450}
451
452func TestSwitchUserMakesSecureTokenActive(t *testing.T) {
453 // Given we have a user with a secure token

Callers

nothing calls this directly

Calls 3

MockInitWithErrorFunction · 0.92
newTestAuthConfigFunction · 0.85
LogoutMethod · 0.65

Tested by

no test coverage detected