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

Function TestLogoutIgnoresErrorsFromConfigAndKeyring

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

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