MCPcopy Create free account
hub / github.com/cli/cli / TestLogoutIgnoresErrorsFromConfigAndKeyring

Function TestLogoutIgnoresErrorsFromConfigAndKeyring

internal/config/auth_config_test.go:455–466  ·  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

453// really do anything to recover. On the other hand, a user might
454// want to rectify this manually, for example if there were on a shared machine.
455func TestLogoutIgnoresErrorsFromConfigAndKeyring(t *testing.T) {
456 // Given we have keyring that errors, and a config that
457 // doesn't even have a hosts key (which would cause Remove to fail)
458 keyring.MockInitWithError(errors.New("test-explosion"))
459 authCfg := newTestAuthConfig(t)
460
461 // When we logout
462 err := authCfg.Logout("github.com", "test-user")
463
464 // Then it returns success anyway, suppressing the errors
465 require.NoError(t, err)
466}
467
468func TestSwitchUserMakesSecureTokenActive(t *testing.T) {
469 // 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