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

Function TestLogoutIgnoresErrorsFromConfigAndKeyring

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

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