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

Function TestTokenFromKeyringForUser

internal/config/auth_config_test.go:33–44  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

31}
32
33func TestTokenFromKeyringForUser(t *testing.T) {
34 // Given a keyring that contains a token for a host with a specific user
35 authCfg := newTestAuthConfig(t)
36 require.NoError(t, keyring.Set(keyringServiceName("github.com"), "test-user", "test-token"))
37
38 // When we get the token from the auth config
39 token, err := authCfg.TokenFromKeyringForUser("github.com", "test-user")
40
41 // Then it returns successfully with the correct token
42 require.NoError(t, err)
43 require.Equal(t, "test-token", token)
44}
45
46func TestTokenFromKeyringForUserErrorsIfUsernameIsBlank(t *testing.T) {
47 authCfg := newTestAuthConfig(t)

Callers

nothing calls this directly

Calls 5

SetFunction · 0.92
newTestAuthConfigFunction · 0.85
EqualMethod · 0.80
keyringServiceNameFunction · 0.70

Tested by

no test coverage detected