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

Function TestTokenFromKeyring

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

Source from the content-addressed store, hash-verified

18}
19
20func TestTokenFromKeyring(t *testing.T) {
21 // Given a keyring that contains a token for a host
22 authCfg := newTestAuthConfig(t)
23 require.NoError(t, keyring.Set(keyringServiceName("github.com"), "", "test-token"))
24
25 // When we get the token from the auth config
26 token, err := authCfg.TokenFromKeyring("github.com")
27
28 // Then it returns successfully with the correct token
29 require.NoError(t, err)
30 require.Equal(t, "test-token", token)
31}
32
33func TestTokenFromKeyringForUser(t *testing.T) {
34 // Given a keyring that contains a token for a host with a specific user

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected